Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 17, 2010, 4:05:13 PM (13 years ago)
Author:
smerkli
Message:

Minimum target achieved for today, servers can log on to master server, clients can get server list. To be debugged.

File:
1 edited

Legend:

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

    r7631 r7650  
    6363  /* callback for the network reply poller */
    6464  /* NOTE implement protocol-specific part here. */
    65   int replyhandler( char *addr, ENetEvent *ev )
     65  int rhandler( char *addr, ENetEvent *ev )
    6666  {
    67     /* handle incoming data
    68      * if a list entry arrives add to list
    69      * if a done entry arrives set done to true
    70      */
     67    /* handle incoming data */
     68    /* if a list entry arrives add to list */
     69    if( !strncmp( ev->packet->data, MSPROTO_SERVERLIST_ITEM,
     70      MSPROTO_SERVERLIST_ITEM_LEN ) )
     71    {
     72      /* create server structure from that item */
     73      ServerInformation toadd;
     74
     75      /* fill in data */
     76      toadd->setName( std::string(ev->packet->data +
     77        MSPROTO_SERVERLIST_ITEM_LEN) );
     78      toadd->setIP( std::string(ev->packet->data +
     79        MSPROTO_SERVERLIST_ITEM_LEN) );
     80
     81      /* add to list */
     82      this->servers_.add( toadd );
     83    }
     84    else if( !strncmp( ev->packet->data, MSPROTO_SERVERLIST_END,
     85      MSPROTO_SERVERLIST_END_LEN ) )
     86    { return 1; }
    7187
    7288    /* done handling, return all ok code 0 */
     
    8096
    8197    /* send request to server */
    82     msc.sendRequest( MSPROTO_CLIENT MSPROTO_REQ_LIST );
     98    msc.sendRequest( MSPROTO_CLIENT " " MSPROTO_REQ_LIST );
    8399
    84100    /* deal with replies */
    85     while( msc.pollForReply( replyhandler ) )
     101    while( !msc.pollForReply( rhandler ) )
    86102      /* nothing */;
    87103
Note: See TracChangeset for help on using the changeset viewer.