Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 12, 2008, 11:44:01 PM (16 years ago)
Author:
scheusso
Message:

fixed a 'bug' in WE-Model-Spaceship

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network3/src/network/Server.cc

    r1253 r1261  
    5353namespace network
    5454{
     55 
     56 
     57#define MAX_FAILURES 20;
     58 
     59 
    5560  /**
    5661  * Constructor for default values (bindaddress is set to ENET_HOST_ANY
     
    205210      }
    206211      //std::cout << "adding gamestate" << std::endl;
    207       if ( !(connection->addPacket(packet_gen.gstate(gs), cid)) )
    208         COUT(4) << "Server: packet with client id (cid): " << cid << " not sended" << std::endl;
     212      if ( !(connection->addPacket(packet_gen.gstate(gs), cid)) ){
     213        COUT(3) << "Server: packet with client id (cid): " << cid << " not sended: " << temp->failures_ << std::endl;
     214        temp->failures_++;
     215        if(temp->failures_ > 20 )
     216          disconnectClient(temp);
    209217      //std::cout << "added gamestate" << std::endl;
     218      }
    210219      added=true;
    211220      temp=temp->next();
     
    240249    if(!gamestates->pushGameState(data, clientID))
    241250        COUT(3) << "Could not push gamestate\t\t\t\t=====" << std::endl;
    242   }
    243 
     251    else
     252        clients->findClient(clientID)->failures_=0;
     253  }
     254
     255  void Server::disconnectClient(int clientID){
     256    ClientInformation *client = clients->findClient(clientID);
     257    disconnectClient(client);
     258  }
     259  void Server::disconnectClient( ClientInformation *client){
     260    connection->disconnectClient(client);
     261    gamestates->removeClient(client);
     262  }
     263 
    244264}
Note: See TracChangeset for help on using the changeset viewer.