Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 1, 2010, 1:51:15 PM (13 years ago)
Author:
smerkli
Message:

further testing.

File:
1 edited

Legend:

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

    r7672 r7684  
    4646      return 1;
    4747    }
     48
     49    /* initialize the event holder */
     50    this->event = (ENetEvent *)calloc( sizeof(ENetEvent), 1 );
    4851   
    4952    /* install atexit handler for enet */
     
    8992
    9093    /* Wait up to 2 seconds for the connection attempt to succeed. */
    91     if (enet_host_service (this->client, &this->event, 2000) > 0 &&
    92         this->event.type == ENET_EVENT_TYPE_CONNECT )
     94    if (enet_host_service (this->client, this->event, 2000) > 0 &&
     95        this->event->type == ENET_EVENT_TYPE_CONNECT )
    9396      fprintf( stdout, "Connection to server succeeded." );
    9497    else
     
    107110    /* see whether anything happened */
    108111    /* WORK MARK REMOVE THIS OUTPUT */
    109     COUT(2) << "MARK polling...\n";
     112    //COUT(2) << "MARK polling...\n";
    110113
    111114    /* enet_host_service returns 0 if no event occured */
    112115    /* just newly set below test to >0 from >= 0, to be tested */
    113     if( enet_host_service( this->client, &this->event, 1000 ) > 0 )
     116    if( enet_host_service( this->client, this->event, 1000 ) > 0 )
    114117    {
    115118      /* address buffer */
     
    118121
    119122      /* check what type of event it is and react accordingly */
    120       switch (this->event.type)
     123      switch (this->event->type)
    121124      { /* new connection, not supposed to happen. */
    122125        case ENET_EVENT_TYPE_CONNECT: break;
     
    128131        case ENET_EVENT_TYPE_RECEIVE:
    129132          addrconv = (char *) calloc( 50, 1 );
    130           enet_address_get_host_ip( &(this->event.peer->address), addrconv, 49 );
     133          enet_address_get_host_ip( &(this->event->peer->address),
     134            addrconv, 49 );
    131135
    132136          /* DEBUG */
    133137          printf( "A packet of length %u containing %s was "
    134138            "received from %s on channel %u.\n",
    135             this->event.packet->dataLength,
    136             this->event.packet->data,
     139            this->event->packet->dataLength,
     140            this->event->packet->data,
    137141            addrconv,
    138             this->event.channelID );
     142            this->event->channelID );
    139143          /* END DEBUG */
    140144
    141145          /* call the supplied callback, if any. */
    142146          if( (*callback) != NULL )
    143             retval = (*callback)( addrconv, &(this->event) );
    144 
    145           enet_packet_destroy( event.packet );
     147            retval = (*callback)( addrconv, (this->event) );
     148
     149          enet_packet_destroy( event->packet );
    146150          if( addrconv ) free( addrconv );
    147151          break;
Note: See TracChangeset for help on using the changeset viewer.