Changeset 8327 for code/trunk/src/libraries/network/ServerConnection.cc
- Timestamp:
- Apr 25, 2011, 8:22:36 PM (13 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/network6 (added) merged: 7823-7825,7875,7878,7881-7882,7898,7900,7931,8315
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/network/ServerConnection.cc
r7801 r8327 35 35 36 36 #include "util/Debug.h" 37 #include "ClientInformation.h" 37 #include <util/Sleep.h> 38 // #include "ClientInformation.h" 38 39 39 40 namespace orxonox … … 44 45 { 45 46 this->bindAddress_ = new ENetAddress(); 46 memset(this->bindAddress_, 0, sizeof(ENetAddress));47 // memset(this->bindAddress_, 0, sizeof(ENetAddress)); 47 48 this->bindAddress_->host = ENET_HOST_ANY; 48 49 this->bindAddress_->port = NETWORK_PORT; 50 this->bindAddress_->scopeID = 0; 49 51 } 50 52 … … 104 106 void ServerConnection::addPacket(ENetPacket *packet, unsigned int clientID, uint8_t channelID) 105 107 { 106 if ( clientID == CLIENTID_UNKNOWN)108 if ( clientID == NETWORK_PEER_ID_BROADCAST ) 107 109 { 108 110 broadcastPacket(packet, channelID); … … 110 112 else 111 113 { 112 ClientInformation *temp = ClientInformation::findClient(clientID);113 if(!temp){114 COUT(3) << "C.Man: addPacket findClient failed" << std::endl;115 }116 Connection::addPacket(packet, temp->getPeer(), channelID);114 // ClientInformation *temp = ClientInformation::findClient(clientID); 115 // if(!temp){ 116 // COUT(3) << "C.Man: addPacket findClient failed" << std::endl; 117 // } 118 Connection::addPacket(packet, clientID, channelID); 117 119 } 118 120 } 119 121 120 void ServerConnection::disconnectClient(ClientInformation *client)121 {122 Connection::disconnectPeer( client->getPeer() );123 }122 // void ServerConnection::disconnectClient(ClientInformation *client) 123 // { 124 // Connection::disconnectPeer( client->getPeer() ); 125 // } 124 126 125 127 void ServerConnection::disconnectClient(int clientID) 126 128 { 127 ClientInformation *client = ClientInformation::findClient(clientID);128 if(client)129 ServerConnection::disconnectClient(client);129 // ClientInformation *client = ClientInformation::findClient(clientID); 130 // if(client) 131 ServerConnection::disconnectClient(clientID); 130 132 } 131 133 132 134 void ServerConnection::disconnectClients() 133 135 { 134 ClientInformation *temp = ClientInformation::getBegin(); 135 while(temp!=0) 136 { 137 ServerConnection::disconnectClient( temp ); 138 temp = temp->next(); 139 } 136 Connection::disconnectPeers(); 137 Connection::waitOutgoingQueue(); 140 138 return; 141 139 } 142 140 143 141 144 int ServerConnection::getClientID(ENetPeer* peer)145 {146 return getClientID(&(peer->address));147 }142 // int ServerConnection::getClientID(ENetPeer* peer) 143 // { 144 // return getClientID(&(peer->address)); 145 // } 148 146 149 int ServerConnection::getClientID(ENetAddress* address)150 {151 return ClientInformation::findClient(address)->getID();152 }153 154 ENetPeer *ServerConnection::getClientPeer(int clientID)155 {156 return ClientInformation::findClient(clientID)->getPeer();157 }147 // int ServerConnection::getClientID(ENetAddress* address) 148 // { 149 // return ClientInformation::findClient(address)->getID(); 150 // } 151 // 152 // ENetPeer *ServerConnection::getClientPeer(int clientID) 153 // { 154 // return ClientInformation::findClient(clientID)->getPeer(); 155 // } 158 156 159 157
Note: See TracChangeset
for help on using the changeset viewer.