Changeset 8858 for code/trunk/src/libraries/network/MasterServerComm.cc
- Timestamp:
- Aug 23, 2011, 12:45:53 AM (13 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:ignore
-
old new 1 1 build 2 2 codeblocks 3 vs 3 4 dependencies
-
- Property svn:mergeinfo changed
/code/branches/output (added) merged: 8739-8740,8765,8771-8772,8774-8780,8787-8789,8794-8799,8801,8803-8812,8814,8816-8817,8820,8822,8825-8837,8840,8844,8846,8848-8850,8853-8854
- Property svn:ignore
-
code/trunk/src/libraries/network/MasterServerComm.cc
r8351 r8858 28 28 29 29 #include "MasterServerComm.h" 30 #include "util/Debug.h" 30 #include "util/Output.h" 31 #include "WANDiscovery.h" 31 32 32 33 namespace orxonox … … 44 45 /* initialize Enet */ 45 46 if( enet_initialize () != 0 ) 46 { COUT(1) << "An error occurred while initializing ENet.\n";47 { orxout(internal_error, context::master_server) << "An error occurred while initializing ENet." << endl; 47 48 return 1; 48 49 } … … 61 62 /* see if it worked */ 62 63 if (this->client == NULL) 63 { COUT(1) << "An error occurred while trying to create an "64 << "ENet client host. \n";64 { orxout(internal_error, context::master_server) << "An error occurred while trying to create an " 65 << "ENet client host." << endl; 65 66 return 1; 66 67 } … … 85 86 86 87 if( this->peer == NULL ) 87 { COUT(2) << "ERROR:No available peers for initiating an ENet"88 << " connection. \n";88 { orxout(internal_error, context::master_server) << "No available peers for initiating an ENet" 89 << " connection." << endl; 89 90 return -1; 90 91 } … … 93 94 if (enet_host_service (this->client, &this->event, 500) > 0 && 94 95 this->event.type == ENET_EVENT_TYPE_CONNECT ) 95 COUT(3) << "Connection to master server succeeded.\n";96 orxout(internal_info, context::master_server) << "Connection to master server succeeded." << endl; 96 97 else 97 98 { 98 99 enet_peer_reset (this->peer); 99 COUT(2) << "ERROR: connection to " << address << " failed.\n";100 orxout(internal_warning, context::master_server) << "Connection to " << address << " failed." << endl; 100 101 return -1; 101 102 } … … 128 129 129 130 case ENET_EVENT_TYPE_DISCONNECT: 130 COUT(4) << "Disconnect from master server successful.\n";131 orxout(verbose, context::master_server) << "Disconnect from master server successful." << endl; 131 132 return 0; 132 133 default: break; … … 149 150 * so we can also make callbacks from objects 150 151 */ 151 int MasterServerComm::pollForReply( int (*callback)( char*, ENetEvent* ), 152 int delayms ) 152 int MasterServerComm::pollForReply( WANDiscovery* listener, int delayms ) 153 153 { 154 154 /* see whether anything happened */ 155 155 /* WORK MARK REMOVE THIS OUTPUT */ 156 COUT(2) << "polling masterserver...\n";156 orxout(verbose, context::master_server) << "polling masterserver..." << endl; 157 157 158 158 /* address buffer */ … … 176 176 addrconv = (char *) calloc( 50, 1 ); 177 177 if( !addrconv ) 178 { COUT(2) << "MasterServerComm.cc: Could not allocate memory!\n";178 { orxout(internal_warning, context::master_server) << "MasterServerComm.cc: Could not allocate memory!" << endl; 179 179 break; 180 180 } … … 185 185 186 186 /* DEBUG */ 187 COUT(3) << "MasterServer Debug: A packet of length "187 orxout(verbose, context::master_server) << "MasterServer Debug: A packet of length " 188 188 << this->event.packet->dataLength 189 189 << " containing " << this->event.packet->data … … 193 193 194 194 /* call the supplied callback, if any. */ 195 if( (*callback)!= NULL )196 retval = (*callback)( addrconv, &(this->event) );195 if( listener != NULL ) 196 retval = listener->rhandler( addrconv, &(this->event) ); 197 197 198 198 /* clean up */
Note: See TracChangeset
for help on using the changeset viewer.