Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7774


Ignore:
Timestamp:
Dec 17, 2010, 11:49:08 AM (14 years ago)
Author:
scheusso
Message:

some comments
enable enet packet compression

Location:
code/branches/network5/src/libraries/network
Files:
4 edited

Legend:

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

    r7773 r7774  
    7070    ENetEvent event;
    7171
     72    // create host
    7273    this->host_ = enet_host_create(NULL, NETWORK_CLIENT_MAX_CONNECTIONS, NETWORK_CHANNEL_COUNT, 0, 0);
     74   
    7375    if ( this->host_ == NULL )
    7476    {
     
    7779      return false;
    7880    }
     81   
     82    // enable compression
     83    this->enableCompression();
     84   
    7985    assert( this->host_->socket4 != ENET_SOCKET_NULL || this->host_->socket6 != ENET_SOCKET_NULL );
    8086    if (this->host_->socket4 == ENET_SOCKET_NULL)
  • code/branches/network5/src/libraries/network/Connection.cc

    r7772 r7774  
    210210    return p->process();
    211211  }
     212 
     213  void Connection::enableCompression()
     214  {
     215    enet_host_compress_with_range_coder( this->host_ );
     216  }
     217
    212218
    213219}
  • code/branches/network5/src/libraries/network/Connection.h

    r7772 r7774  
    9595    void communicationThread();
    9696    virtual void disconnectPeer(ENetPeer *peer);
     97   
     98    void enableCompression();
    9799
    98100    void processQueue();
  • code/branches/network5/src/libraries/network/ServerConnection.cc

    r7773 r7774  
    6868  bool ServerConnection::openListener()
    6969  {
     70    // create host
    7071    this->host_ = enet_host_create(this->bindAddress_, NETWORK_MAX_CONNECTIONS, NETWORK_CHANNEL_COUNT, 0, 0);
     72   
    7173    if ( this->host_ == NULL )
    7274    {
     
    7476        return false;
    7577    }
     78   
     79    // enable compression
     80    this->enableCompression();
    7681    assert( this->host_->socket4 != ENET_SOCKET_NULL || this->host_->socket6 != ENET_SOCKET_NULL );
    7782    if (this->host_->socket4 == ENET_SOCKET_NULL)
     
    8287        COUT(3) << "Info: Using IPv4 and IPv6 Sockets." << std::endl;
    8388   
     89    // start communication thread
    8490    Connection::startCommunicationThread();
    8591
Note: See TracChangeset for help on using the changeset viewer.