Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9470 in orxonox.OLD for branches/proxy/src/lib/network


Ignore:
Timestamp:
Jul 25, 2006, 10:23:17 PM (18 years ago)
Author:
patrick
Message:

heavy permissions fight: no node was ever thought to be client and server at the same time, proxy server are hybrid nodes so there is need for a big framework extension.

  • made the obb creation saver
  • prevented segfaults in the aabb tree creation, this was very dangerous code
  • inserted handshake hack to make the handshake work.

No I will have to get the handshake right so the node works correctly

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

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/network_game_manager.cc

    r9452 r9470  
    9191bool NetworkGameManager::signalNewPlayer( int userId )
    9292{
    93   assert( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServerActive());
     93  assert( SharedNetworkData::getInstance()->isMasterServer() /*||  SharedNetworkData::getInstance()->isProxyServerActive()*/);
    9494  assert( State::getGameRules() );
    9595  assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) );
     
    168168bool NetworkGameManager::delSynchronizeableHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
    169169{
    170   if ( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServerActive())
     170  if ( SharedNetworkData::getInstance()->isMasterServer() /*||  SharedNetworkData::getInstance()->isProxyServerActive()*/)
    171171  {
    172172    PRINTF(2)("Recieved DeleteSynchronizeable message from client %d!\n", userId);
     
    229229bool NetworkGameManager::preferedTeamHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
    230230{
    231   assert( SharedNetworkData::getInstance()->isMasterServer() ||  SharedNetworkData::getInstance()->isProxyServerActive());
     231  assert( SharedNetworkData::getInstance()->isMasterServer() /*||  SharedNetworkData::getInstance()->isProxyServerActive()*/);
    232232
    233233  int teamId = 0;
     
    261261void NetworkGameManager::prefereTeam( int teamId )
    262262{
    263   if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
     263  if ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/)
    264264    setPreferedTeam( SharedNetworkData::getInstance()->getHostID(), teamId );
    265265  else
     
    305305{
    306306  PRINTF(0)("NetworkGameManager::chatMessageHandler %d %d\n", userId, SharedNetworkData::getInstance()->getHostID() );
    307   if ( (SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive()) && userId !=  SharedNetworkData::getInstance()->getHostID() )
     307  if ( (SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/) && userId !=  SharedNetworkData::getInstance()->getHostID() )
    308308  {
    309309    MessageManager::getInstance()->sendMessage( messageId, data, dataLength, RT_ALL_NOT_ME, 0, MP_HIGHBANDWIDTH );
     
    347347  assert( Converter::stringToByteArray(message, buf+2*INTSIZE, message.length()+INTSIZE) == message.length()+INTSIZE );
    348348
    349   if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
     349  if ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/)
    350350    MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, message.length()+3*INTSIZE, RT_ALL_ME, 0, MP_HIGHBANDWIDTH );
    351351  else
  • branches/proxy/src/lib/network/network_manager.cc

    r9467 r9470  
    131131
    132132  // create the network stream af
    133   this->networkStream = new NetworkStream(NET_PROXY_SERVER_ACTIVE);
     133  this->networkStream = new NetworkStream(NET_PROXY_SERVER_ACTIVE );
    134134  // first connect to the master server for synchronization
    135135  this->networkStream->connectToMasterServer(NetworkSettings::getInstance()->getMasterAddr().ipString(), 9999);
  • branches/proxy/src/lib/network/network_stream.cc

    r9468 r9470  
    208208 * @param port: the port number
    209209 */
    210 void NetworkStream::connectToProxyServer(int proxyId,std::string host, int port)
     210void NetworkStream::connectToProxyServer(int proxyId, std::string host, int port)
    211211{
    212212  PRINTF(0)("connect to proxy %s, this is proxyId %i\n", host.c_str(), proxyId);
     
    253253void NetworkStream::startHandshake(int userId)
    254254{
    255   Handshake* hs = new Handshake(this->pInfo->nodeType);
     255  Handshake* hs = new Handshake(NET_CLIENT/* this->pInfo->nodeType*/);
    256256  // fake the unique id
    257257  hs->setUniqueID( NET_UID_HANDSHAKE );
     
    323323    this->updateConnectionList();
    324324  }
    325   else if( this->pInfo->isProxyServerActive())
    326   {
     325//   else if( this->pInfo->isProxyServerActive())
     326//   {
    327327    // execute everything the proxy server should do
    328     if ( this->clientSocket )
    329       this->clientSocket->update();
    330     if( this->proxySocket)
    331       this->proxySocket->update();
    332 
    333     this->updateConnectionList();
    334   }
     328
     329//     if ( this->clientSocket )
     330//       this->clientSocket->update();
     331//     if( this->proxySocket)
     332//       this->proxySocket->update();
     333//
     334//     this->updateConnectionList();
     335//   }
    335336  else
    336337  {
     
    554555          {
    555556            // make sure this is a client
    556             if( this->pInfo->isClient())
     557            if( this->pInfo->isClient() || SharedNetworkData::getInstance()->isProxyServerActive())
    557558            {
    558559              SharedNetworkData::getInstance()->setHostID( it->second.handshake->getHostId() );
     
    752753
    753754      // if we are a server (both master and proxy servers) and this is not our handshake
    754       if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive() ) && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
     755      if ( ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/ ) && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
    755756        continue;
    756757
     
    766767
    767768      // server fakes uniqueid == 0 for handshake
    768       if ( ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive() ) &&
     769      if ( ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive() */) &&
    769770             sync.getUniqueID() <= SharedNetworkData::getInstance()->getMaxPlayer() + 1) // plus one to handle one client more than the max to redirect it
    770771        n = Converter::intToByteArray( 0, buf + offset, UDP_PACKET_SIZE - offset );
     
    818819    // now compress the data with the zip library
    819820    int compLength = 0;
    820     if ( SharedNetworkData::getInstance()->isMasterServer() || SharedNetworkData::getInstance()->isProxyServerActive())
     821    if ( SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/)
    821822      compLength = Zip::getInstance()->zip( buf, offset, compBuf, UDP_PACKET_SIZE, dictServer );
    822823    else
     
    936937
    937938          // if the node we got this unknown sync from is a client we ignore it (since it has no rights to create a new sync)
    938           if ( peers[peer->second.userId].isClient() )
     939          if ( peers[peer->second.userId].isClient() || peers[peer->second.userId].isProxyServerActive())
    939940          {
    940941            offset += syncDataLength;
  • branches/proxy/src/lib/network/peer_info.cc

    r9445 r9470  
    5858  return PeerInfo::nodeTypeToString( this->nodeType );
    5959  // the above does the same, and is faster in it. (there is no case where node is uninit i hope!)
    60 /*
    61   switch( this->nodeType)
    62   {
    63     case NET_CLIENT:
    64       return std::string("client");
    65     case NET_PROXY_SERVER_ACTIVE:
    66       return std::string("proxy server active");
    67     case NET_PROXY_SERVER_PASSIVE:
    68       return std::string("proxy server passive");
    69     case NET_MASTER_SERVER:
    70       return std::string("master server");
    71   }
    72 
    73   return std::string("node is uninit");*/
    7460}
    7561
  • branches/proxy/src/lib/network/shared_network_data.h

    r9452 r9470  
    2828
    2929    /** @returns the next uniqueID free for an object */
    30     inline int getNewUniqueID() { return ( this->nodeType != NET_CLIENT)?this->newUniqueID++:-1; }
     30    inline int getNewUniqueID() { return ( isMasterServer())?this->newUniqueID++:-1; }
    3131    /** sets the @param newUniqueID: the new offset for the next unique id */
    3232    inline void setNewUniqueID(int newUniqueID) { this->newUniqueID = newUniqueID; }
Note: See TracChangeset for help on using the changeset viewer.