Changeset 7801 for code/trunk/src/libraries/network/ClientConnection.cc
- Timestamp:
- Dec 22, 2010, 7:24:24 PM (13 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/network/ClientConnection.cc
r7459 r7801 39 39 const unsigned int NETWORK_CLIENT_CONNECTION_TIMEOUT = 3000; //millisecs 40 40 const unsigned int NETWORK_CLIENT_MAX_CONNECTIONS = 1; 41 const unsigned int NETWORK_CLIENT_CHANNELS = 1;42 41 43 42 … … 71 70 ENetEvent event; 72 71 73 this->host_ = enet_host_create(NULL, NETWORK_CLIENT_MAX_CONNECTIONS, 0, 0, 0); 72 // create host 73 this->host_ = enet_host_create(NULL, NETWORK_CLIENT_MAX_CONNECTIONS, NETWORK_CHANNEL_COUNT, 0, 0); 74 74 75 if ( this->host_ == NULL ) 75 76 { … … 78 79 return false; 79 80 } 81 82 // enable compression 83 this->enableCompression(); 84 80 85 assert( this->host_->socket4 != ENET_SOCKET_NULL || this->host_->socket6 != ENET_SOCKET_NULL ); 81 86 if (this->host_->socket4 == ENET_SOCKET_NULL) … … 86 91 COUT(3) << "Info: Using IPv4 and IPv6 Sockets." << std::endl; 87 92 88 this->server_ = enet_host_connect(this->host_, serverAddress_, NETWORK_C LIENT_CHANNELS, 0);93 this->server_ = enet_host_connect(this->host_, serverAddress_, NETWORK_CHANNEL_COUNT, 0); 89 94 if ( this->server_==NULL ) 90 95 { … … 99 104 { 100 105 this->established_=true; 106 Connection::startCommunicationThread(); 101 107 return true; 102 108 } … … 112 118 return true; 113 119 this->established_ = false; 120 Connection::stopCommunicationThread(); 114 121 enet_peer_disconnect(this->server_, 0); 115 122 for( unsigned int i=0; i<NETWORK_CLIENT_CONNECTION_TIMEOUT/NETWORK_CLIENT_WAIT_TIME; i++) … … 138 145 139 146 140 bool ClientConnection::addPacket(ENetPacket *packet) {147 void ClientConnection::addPacket(ENetPacket *packet, uint8_t channelID) { 141 148 assert( this->server_ ); 142 149 assert( packet ); 143 return Connection::addPacket( packet, this->server_ );150 return Connection::addPacket( packet, this->server_, channelID ); 144 151 } 145 152 … … 153 160 COUT(1) << "Received disconnect Packet from Server!" << endl; 154 161 // server closed the connection 162 this->stopCommunicationThread(); 155 163 this->connectionClosed(); 156 164 }
Note: See TracChangeset
for help on using the changeset viewer.