Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 21, 2009, 12:55:44 AM (16 years ago)
Author:
scheusso
Message:
  • fix in connection handling
  • reduced debug cpu load on server/client a lot (very inefficient checking for double objectIDs before)
Location:
code/branches/netp3/src/network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/netp3/src/network/Client.cc

    r2992 r3003  
    149149        COUT(4) << "popping partial gamestate: " << std::endl;
    150150        packet::Gamestate *gs = gamestate.getGamestate();
     151        assert(gs);
    151152        if(gs){
    152153          COUT(4) << "client tick: sending gs " << gs << std::endl;
  • code/branches/netp3/src/network/ClientConnection.cc

    r2990 r3003  
    208208  bool ClientConnection::disconnectConnection() {
    209209    ENetEvent event;
     210    if(this->quit_)
     211      return true;
    210212    boost::recursive_mutex::scoped_lock lock(enet_mutex_g);
    211213    enet_peer_disconnect(server, 0);
  • code/branches/netp3/src/network/packet/Gamestate.cc

    r2990 r3003  
    179179    }
    180180  }
    181 
    182181   // In debug mode, check first, whether there are no duplicate objectIDs
    183182#ifndef NDEBUG
    184   ObjectList<Synchronisable>::iterator it;
    185   for (it = ObjectList<Synchronisable>::begin(); it != ObjectList<Synchronisable>::end(); ++it) {
    186     if (it->getObjectID() == OBJECTID_UNKNOWN) {
    187       if (it->objectMode_ != 0x0) {
    188         COUT(0) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << std::endl;
    189         COUT(0) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << std::endl;
    190         COUT(0) << "Objects class: " << it->getIdentifier()->getName() << std::endl;
    191         assert(false);
    192       }
    193     }
    194     else {
    195       ObjectList<Synchronisable>::iterator it2;
    196       for (it2 = ObjectList<Synchronisable>::begin(); it2 != ObjectList<Synchronisable>::end(); ++it2) {
    197         if (it->getObjectID() == it2->getObjectID() && *it != *it2) {
    198            COUT(0) << "Found duplicate objectIDs on the client!" << std::endl
    199                    << "Are you sure you don't create a Sychnronisable objcect with 'new' \
    200                        that doesn't have objectMode = 0x0?" << std::endl;
    201            assert(false);
     183  if(this->getID()%1000==0){
     184    std::vector<uint32_t> v1;
     185    ObjectList<Synchronisable>::iterator it;
     186    for (it = ObjectList<Synchronisable>::begin(); it != ObjectList<Synchronisable>::end(); ++it) {
     187      if (it->getObjectID() == OBJECTID_UNKNOWN) {
     188        if (it->objectMode_ != 0x0) {
     189          COUT(0) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << std::endl;
     190          COUT(0) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << std::endl;
     191          COUT(0) << "Objects class: " << it->getIdentifier()->getName() << std::endl;
     192          assert(false);
    202193        }
     194      }
     195      else {
     196        std::vector<uint32_t>::iterator it2;
     197        for (it2 = v1.begin(); it2 != v1.end(); ++it2) {
     198          if (it->getObjectID() == *it2) {
     199            COUT(0) << "Found duplicate objectIDs on the client!" << std::endl
     200                    << "Are you sure you don't create a Sychnronisable objcect with 'new' \
     201                        that doesn't have objectMode = 0x0?" << std::endl;
     202            assert(false);
     203          }
     204        }
     205        v1.push_back(it->getObjectID());
    203206      }
    204207    }
Note: See TracChangeset for help on using the changeset viewer.