Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 15, 2008, 10:08:41 PM (16 years ago)
Author:
scheusso
Message:

a huge fix in packetbuffer

File:
1 edited

Legend:

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

    r1264 r1299  
    117117    ENetPacket *packet = packet_gen.chatMessage(msg.c_str());
    118118    //std::cout <<"adding packets" << std::endl;
    119     connection->addPacketAll(packet);
     119    if(connection->addPacketAll(packet))
    120120    //std::cout <<"added packets" << std::endl;
    121     return connection->sendPackets();
     121      return connection->sendPackets();
     122    else
     123      return false;
    122124  }
    123125
     
    162164      //clientID here is a reference to grab clientID from ClientInformation
    163165      packet = connection->getPacket(clientID);
     166      if(!packet)
     167        continue;
    164168      //if statement to catch case that packetbuffer is empty
    165169      if( !elaborate(packet, clientID) )
    166         COUT(4) << "Server: PacketBuffer empty" << std::endl;
     170        COUT(3) << "Server: could not elaborate" << std::endl;
    167171    }
    168172  }
     
    238242 
    239243  bool Server::processConnectRequest( connectRequest *con, int clientID ){
    240     COUT(4) << "processing connectRequest " << std::endl;
     244    COUT(3) << "processing connectRequest " << std::endl;
    241245    //connection->addPacket(packet_gen.gstate(gamestates->popGameState(clientID)) , clientID);
    242246    connection->createClient(clientID);
     
    250254        COUT(3) << "Could not push gamestate\t\t\t\t=====" << std::endl;
    251255    else
     256      if(clients->findClient(clientID))
    252257        clients->findClient(clientID)->failures_=0;
    253258  }
     
    255260  void Server::disconnectClient(int clientID){
    256261    ClientInformation *client = clients->findClient(clientID);
    257     disconnectClient(client);
     262    if(client)
     263      disconnectClient(client);
    258264  }
    259265  void Server::disconnectClient( ClientInformation *client){
Note: See TracChangeset for help on using the changeset viewer.