Changeset 7692 for code/branches/masterserver/src/libraries
- Timestamp:
- Dec 1, 2010, 4:28:46 PM (14 years ago)
- Location:
- code/branches/masterserver/src/libraries/network
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/masterserver/src/libraries/network/MasterServerComm.cc
r7684 r7692 110 110 /* see whether anything happened */ 111 111 /* WORK MARK REMOVE THIS OUTPUT */ 112 //COUT(2) << "MARK polling...\n"; 112 COUT(2) << "polling masterserver...\n"; 113 114 /* address buffer */ 115 char *addrconv = NULL; 116 int retval = 0; 113 117 114 118 /* enet_host_service returns 0 if no event occured */ … … 116 120 if( enet_host_service( this->client, this->event, 1000 ) > 0 ) 117 121 { 118 /* address buffer */119 char *addrconv = NULL;120 int retval = 0;121 122 122 /* check what type of event it is and react accordingly */ 123 123 switch (this->event->type) … … 131 131 case ENET_EVENT_TYPE_RECEIVE: 132 132 addrconv = (char *) calloc( 50, 1 ); 133 if( !addrconv ) 134 { COUT(2) << "MasterServerComm.cc: Could not allocate memory!\n"; 135 break; 136 } 137 138 /* resolve IP */ 133 139 enet_address_get_host_ip( &(this->event->peer->address), 134 140 addrconv, 49 ); … … 175 181 enet_host_flush( this->client ); 176 182 177 if( packet ) free( packet ); 183 /* free the packet */ 184 enet_packet_destroy( packet ); 178 185 179 186 /* all done. */ -
code/branches/masterserver/src/libraries/network/MasterServerProtocol.h
r7688 r7692 31 31 32 32 /* master server address (to be moved elsewhere later) */ 33 #define MS_ADDRESS "1 72.16.113.1"33 #define MS_ADDRESS "129.132.3.8" 34 34 35 35 #define MSPROTO_CLIENT "CL" -
code/branches/masterserver/src/libraries/network/WANDiscovery.cc
r7688 r7692 96 96 * the list 97 97 */ 98 return 1;98 return 2; 99 99 } 100 100 101 101 /* done handling, return all ok code 0 */ 102 return 0;102 return 1; 103 103 } 104 104 … … 112 112 113 113 /* poll for replies */ 114 /* TODO add some timeout here so we don't wait indefinitely */ 115 while( !((this->msc).pollForReply( rhandler )) ) 116 /* nothing */; 117 118 /* done receiving. */ 114 int i = WANDISC_MAXTRIES; 115 while( i > 0 ) 116 { 117 /* poll for reply and act according to what was received */ 118 switch( this->msc.pollForReply( rhandler ) ) 119 { case 0: /* no event occured, decrease timeout */ 120 --i; break; 121 case 1: /* got a list element, continue */ 122 break; 123 case 2: /* done. */ 124 i = 0; break; 125 } 126 } 119 127 } 120 128 -
code/branches/masterserver/src/libraries/network/WANDiscovery.h
r7672 r7692 38 38 #include <vector> 39 39 40 #define WANDISC_MAXTRIES 5 40 41 41 42 // tolua_begin
Note: See TracChangeset
for help on using the changeset viewer.