Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5851 for code/branches


Ignore:
Timestamp:
Oct 1, 2009, 4:40:28 PM (15 years ago)
Author:
scheusso
Message:

cleaned up a little bit in connection handling

Location:
code/branches/core5/src/libraries/network
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/libraries/network/ClientConnection.cc

    r5749 r5851  
    133133  }
    134134
    135   void ClientConnection::addClient(ENetEvent* event)
     135  void ClientConnection::addPeer(ENetEvent* event)
    136136  {
    137137    assert(0);
    138138  }
    139   void ClientConnection::disconnectPeer(ENetEvent* event)
     139  void ClientConnection::removePeer(ENetEvent* event)
    140140  {
    141141    this->established_=false;
  • code/branches/core5/src/libraries/network/ClientConnection.h

    r5738 r5851  
    5454    inline bool isConnected(){ return this->established_; }
    5555  private:
    56     virtual void addClient(ENetEvent* event);
    57     virtual void disconnectPeer(ENetEvent* event);
     56    virtual void addPeer(ENetEvent* event);
     57    virtual void removePeer(ENetEvent* event);
    5858   
    5959    bool disconnectConnection();
  • code/branches/core5/src/libraries/network/Connection.cc

    r5849 r5851  
    8383        // log handling ================
    8484        case ENET_EVENT_TYPE_CONNECT:
    85           addClient( &event );
     85          addPeer( &event );
    8686          break;
    8787        case ENET_EVENT_TYPE_DISCONNECT:
    88           disconnectPeer( &event );
     88          removePeer( &event );
    8989          break;
    9090        case ENET_EVENT_TYPE_RECEIVE:
  • code/branches/core5/src/libraries/network/Connection.h

    r5849 r5851  
    6767   
    6868    void processQueue();
    69     virtual void addClient(ENetEvent* event)=0;
    70     virtual void disconnectPeer(ENetEvent* event)=0;
     69    virtual void addPeer(ENetEvent* event)=0;
     70    virtual void removePeer(ENetEvent* event)=0;
    7171    virtual bool processPacket(ENetEvent* event);
    7272   
  • code/branches/core5/src/libraries/network/Server.cc

    r5847 r5851  
    270270
    271271
    272   void Server::addClient(ENetEvent *event){
     272  void Server::addPeer(ENetEvent *event){
    273273    static unsigned int newid=1;
    274274
     
    289289    createClient(temp->getID());
    290290}
     291
     292  void Server::removePeer(ENetEvent *event)
     293  {
     294    COUT(4) << "removing client from list" << std::endl;
     295    ClientInformation *client = ClientInformation::findClient(&event->peer->address);
     296    if(!client)
     297      return;
     298    else
     299    {
     300      //ServerConnection::disconnectClient( client );
     301      ClientConnectionListener::broadcastClientDisconnected( client->getID() );
     302      delete client;
     303    }
     304  }
    291305
    292306  bool Server::createClient(int clientID){
  • code/branches/core5/src/libraries/network/Server.h

    r5738 r5851  
    6565    unsigned int playerID(){return 0;}
    6666   
    67     void addClient(ENetEvent *event);
     67    void addPeer(ENetEvent *event);
     68    void removePeer(ENetEvent *event);
     69   
    6870    bool createClient(int clientID);
    6971    void disconnectClient( ClientInformation *client);
  • code/branches/core5/src/libraries/network/ServerConnection.cc

    r5849 r5851  
    105105  }
    106106 
    107   void ServerConnection::disconnectPeer( ENetEvent* event )
    108   {
    109     COUT(4) << "removing client from list" << std::endl;
    110     ClientInformation *client = ClientInformation::findClient(&event->peer->address);
    111     if(!client)
    112       return;
    113     else
    114       ServerConnection::disconnectClient( client );
    115   }
    116  
    117107  void ServerConnection::disconnectClient(int clientID){
    118108    ClientInformation *client = ClientInformation::findClient(clientID);
  • code/branches/core5/src/libraries/network/ServerConnection.h

    r5849 r5851  
    5959    static bool addPacketAll(ENetPacket *packet);
    6060    virtual void disconnectClient(ClientInformation *client);
    61     virtual void disconnectPeer( ENetEvent* event );
    6261    void disconnectClient(int clientID);
    6362  protected:
Note: See TracChangeset for help on using the changeset viewer.