Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jul 14, 2006, 12:06:30 AM (18 years ago)
Author:
patrick
Message:

another framework switch, and node registration work

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

Legend:

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

    r9281 r9282  
    8080
    8181
     82void NetworkMonitor::addNode(PeerInfo* pInfo)
     83{
     84  return;
     85
     86  if( pInfo->isClient())
     87    this->localNode->addClient(pInfo);
     88  else if( pInfo->isProxyServer())
     89    this->localNode->addProxyServer(pInfo);
     90  else if( pInfo->isMasterServer())
     91    this->localNode->addMasterServer(pInfo);
     92}
     93
    8294/**
    8395 * this displays the network monitor gui
  • branches/proxy/src/lib/network/monitor/network_monitor.h

    r9280 r9282  
    3434    void removeNetworkNode(NetworkNode* node);
    3535
     36    void addNode(PeerInfo* pInfo);
     37    void addNode(NetworkNode* node, PeerInfo* pInfo) {}
     38
     39    /** adds to @param node a network node @param pInfo a new client */
    3640    inline void addClient(NetworkNode* node, PeerInfo* pInfo) { node->addClient(pInfo); }
     41    /** adds to @param node a network node @param pInfo a new proxy server */
    3742    inline void addProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->addProxyServer(pInfo); }
     43    /** adds to @param node a network node @param pInfo a new master server*/
    3844    inline void addMasterServer(NetworkNode* node, PeerInfo* pInfo) { node->addMasterServer(pInfo); }
    3945
     
    5460  private:
    5561    NetworkStream*               networkStream;              //!< reference to the one networkstream of the network
     62    NetworkNode*                 localNode;                  //!< reference to the local node
    5663    std::list<NetworkNode*>      nodeList;                   //!< list of all network nodes
    5764
  • branches/proxy/src/lib/network/network_stream.cc

    r9281 r9282  
    7979  this->peers[0].socket = new UdpSocket( host, port );
    8080  this->peers[0].userId = 0;
    81   this->peers[0].isMasterServer = true;
     81  this->peers[0].nodeType = NET_MASTER_SERVER;
    8282  this->peers[0].connectionMonitor = new ConnectionMonitor( 0 );
    8383}
     
    306306      peers[clientId].handshake->setUniqueID(clientId);
    307307      peers[clientId].userId = clientId;
    308       peers[clientId].isMasterServer = false;
     308      peers[clientId].nodeType = NET_CLIENT;
    309309    }
    310310    else
     
    321321      peers[clientId].connectionMonitor = new ConnectionMonitor( clientId );
    322322      peers[clientId].userId = clientId;
    323       peers[clientId].isMasterServer = false;
     323      peers[clientId].nodeType = NET_CLIENT;
    324324
    325325      PRINTF(0)("num sync: %d\n", synchronizeables.size());
     
    454454//               PRINTF(0)("remote host is a %i\n", it->second.handshake->getRemoteNodeType());
    455455              it->second.nodeType = it->second.handshake->getRemoteNodeType();
     456              this->networkMonitor->addNode(&it->second);
    456457
    457458              this->networkGameManager = NetworkGameManager::getInstance();
     
    719720          }
    720721
    721           if ( !peers[peer->second.userId].isMasterServer )
     722          if ( !peers[peer->second.userId].isMasterServer() )
    722723          {
    723724            offset += syncDataLength;
  • branches/proxy/src/lib/network/network_stream.h

    r9275 r9282  
    5656    /* functions for the peerInfo information retreival */
    5757    inline bool isUserIdActive( int userID ) { return (peers.find(userID) != peers.end()); }
    58     inline bool isUserMasterServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isMasterServer; }
    59     inline bool isUserProxyServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isProxyServer; }
    60     inline bool isUserClient( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isClient; }
     58    inline bool isUserMasterServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isMasterServer(); }
     59    inline bool isUserProxyServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isProxyServer(); }
     60    inline bool isUserClient( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isClient(); }
    6161
    6262
  • branches/proxy/src/lib/network/peer_info.cc

    r9252 r9282  
    4444  this->userId = 0;
    4545  this->nodeType = NET_CLIENT;
    46   this->isMasterServer = false;
    47   this->isProxyServer = false;
    48   this->isClient = false;
    4946  this->socket = NULL;
    5047  this->handshake = NULL;
  • branches/proxy/src/lib/network/peer_info.h

    r9275 r9282  
    2121
    2222
     23    inline bool isMasterServer() { return this->nodeType == NET_MASTER_SERVER; }
     24    inline bool isProxyServer() { return this->nodeType == NET_PROXY_SERVER; }
     25    inline bool isClient() { return this->nodeType == NET_CLIENT; }
     26
     27
    2328  public:
    2429    int                 userId;
    2530    int                 nodeType;
    26     bool                isMasterServer;
    27     bool                isProxyServer;
    28     bool                isClient;
     31//     bool                isMasterServer;
     32//     bool                isProxyServer;
     33//     bool                isClient;
    2934    NetworkSocket *     socket;
    3035    Handshake *         handshake;
Note: See TracChangeset for help on using the changeset viewer.