Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 1, 2010, 4:28:46 PM (14 years ago)
Author:
smerkli
Message:

done for today, didn't get bug to leave, and connect doesn't quite work yet.

Location:
code/branches/masterserver/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/masterserver/src/libraries/network/MasterServerComm.cc

    r7684 r7692  
    110110    /* see whether anything happened */
    111111    /* 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;
    113117
    114118    /* enet_host_service returns 0 if no event occured */
     
    116120    if( enet_host_service( this->client, this->event, 1000 ) > 0 )
    117121    {
    118       /* address buffer */
    119       char *addrconv = NULL;
    120       int retval = 0;
    121 
    122122      /* check what type of event it is and react accordingly */
    123123      switch (this->event->type)
     
    131131        case ENET_EVENT_TYPE_RECEIVE:
    132132          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 */
    133139          enet_address_get_host_ip( &(this->event->peer->address),
    134140            addrconv, 49 );
     
    175181    enet_host_flush( this->client );
    176182   
    177     if( packet ) free( packet );
     183    /* free the packet */
     184    enet_packet_destroy( packet );
    178185
    179186    /* all done. */
  • code/branches/masterserver/src/libraries/network/MasterServerProtocol.h

    r7688 r7692  
    3131
    3232/* master server address (to be moved elsewhere later) */
    33 #define MS_ADDRESS "172.16.113.1"
     33#define MS_ADDRESS "129.132.3.8"
    3434
    3535#define MSPROTO_CLIENT "CL"
  • code/branches/masterserver/src/libraries/network/WANDiscovery.cc

    r7688 r7692  
    9696       * the list
    9797       */
    98       return 1;
     98      return 2;
    9999    }
    100100
    101101    /* done handling, return all ok code 0 */
    102     return 0;
     102    return 1;
    103103  }
    104104 
     
    112112
    113113    /* 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    }
    119127  }
    120128
  • code/branches/masterserver/src/libraries/network/WANDiscovery.h

    r7672 r7692  
    3838#include <vector>
    3939
     40#define WANDISC_MAXTRIES 5
    4041
    4142// tolua_begin
  • code/branches/masterserver/src/modules/masterserver/MasterServer.cc

    r7688 r7692  
    3535{
    3636  /* singleton stuff */
    37   ManageScopedSingleton( MasterServer, ScopeID::Root, false );
     37  //ManageScopedSingleton( MasterServer, ScopeID::Root, false );
    3838
    3939  /* helpers */
Note: See TracChangeset for help on using the changeset viewer.