Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9538 in orxonox.OLD for branches/proxy


Ignore:
Timestamp:
Jul 27, 2006, 11:46:50 PM (18 years ago)
Author:
patrick
Message:

more proxy control functionality: message passing init

Location:
branches/proxy/src/lib/network
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/message_manager.h

    r9524 r9538  
    3636  MSGID_RESPAWN,                              //!< respawn message
    3737
    38   MSGID_FORWARDMESSAGE                        //!< forwarding a messag between proxy and master server
     38  MSGID_PROXY_NEWCLIENT                        //!< informs the master server about a new client
    3939};
    4040
  • branches/proxy/src/lib/network/network_manager.cc

    r9494 r9538  
    3131#include "network_log.h"
    3232#include "network_game_manager.h"
     33#include "proxy/proxy_control.h"
    3334
    3435
     
    116117  this->networkStream->createNetworkGameManager();
    117118
     119  // init the proxy control center
     120  ProxyControl::getInstance();
     121
    118122  PRINTF(0)("Created Network Master Server\n");
    119123  SDL_Delay(20);
     
    140144  this->networkStream->createServer( port, port +1);
    141145
    142 
    143146  // and to the other proxy servers also, this would be very nice if its works
    144 
    145 
    146   // start the network game manager
    147   //this->networkStream->createNetworkGameManager();
    148 
     147  /* put it here....*/
     148
     149  // init the proxy control center
     150  ProxyControl::getInstance();
    149151
    150152  PRINTF(0)("Created Network Proxy Server\n");
  • branches/proxy/src/lib/network/network_stream.cc

    r9537 r9538  
    1111### File Specific:
    1212   main-programmer: Christoph Renner rennerc@ee.ethz.ch
    13    co-programmer:   Patrick Boenzli  boenzlip@orxonox.ethz.ch
     13   co-programmer:   Patrick Boenzli  patrick@orxonox.ethz.ch
    1414
    1515     June 2006: finishing work on the network stream for pps presentation (rennerc@ee.ethz.ch)
    16      July 2006: some code rearangement and integration of the proxy server mechanism (boenzlip@ee.ethz.ch)
     16     July 2006: some code rearangement and integration of the proxy server mechanism (patrick@orxonox.ethz.ch)
    1717*/
    1818
     
    2020#define DEBUG_MODULE_NETWORK
    2121
     22#include "proxy/proxy_control.h"
    2223
    2324#include "base_object.h"
     
    646647
    647648                // work with the ProxyControl to init the new client
     649                ProxyControl::getInstance()->signalNewClient(it->second.userId);
    648650
    649651
  • branches/proxy/src/lib/network/proxy/proxy_control.cc

    r9537 r9538  
    4141  this->setClassID( CL_PROXY_CONTROL, "ProxyControl" );
    4242
    43 //   MessageManager::getInstance()->registerMessageHandler( MSGID_CHANGENICKNAME, changeNickHandler, NULL );
     43  MessageManager::getInstance()->registerMessageHandler( MSGID_PROXY_NEWCLIENT, messageHandlerNewClient, NULL );
    4444
    4545  PRINTF(0)("ProxyControl created\n");
     
    7171}
    7272
     73
     74/**
     75 *  signals new client connected to this local proxy
     76 * @param userId userId of the new client
     77 */
     78void ProxyControl::signalNewClient(int userId)
     79{
     80  // make sure we are a proxy server
     81  assert(SharedNetworkData::getInstance()->isProxyServerActive());
     82
     83
     84}
     85
     86
     87/**
     88 * this is the handler for proxy signals: new clients
     89 *
     90 * @param messageType the type of the message
     91 * @param data message data
     92 * @param dataLength length of the message data
     93 * @param someData some other atteched data
     94 * @param senderId id of the sender client
     95 * @param destinationId id of the destination client
     96 * @return true if succeeded
     97 */
     98bool ProxyControl::messageHandlerNewClient( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId  )
     99{
     100  // part for the master server
     101  if( SharedNetworkData::getInstance()->isMasterServer())
     102  {
     103
     104  }
     105  else if(SharedNetworkData::getInstance()->isProxyServerActive())
     106  {
     107
     108  }
     109
     110  return true;
     111}
  • branches/proxy/src/lib/network/proxy/proxy_control.h

    r9537 r9538  
    1616
    1717
     18
    1819//! A class for storing player information
    1920class ProxyControl : public Synchronizeable
     
    2627
    2728    virtual void varChangeHandler( std::list<int> & id );
     29
     30    void signalNewClient(int userId);
     31    static bool messageHandlerNewClient( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId  );
    2832
    2933
Note: See TracChangeset for help on using the changeset viewer.