Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9586 in orxonox.OLD for branches/proxy/src/lib


Ignore:
Timestamp:
Jul 28, 2006, 10:53:46 PM (18 years ago)
Author:
patrick
Message:

removing the client from the network monitor does also work now

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

Legend:

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

    r9560 r9586  
    176176
    177177
     178
     179/**
     180 * removes a node from the network monitor
     181 * @param pInfo the node to remove
     182 */
     183void NetworkMonitor::removeNode(PeerInfo* pInfo)
     184{
     185  this->removeNode(this->localNode, pInfo);
     186}
     187
     188
     189/**
     190 * removes the network node
     191 * @param node the network node where the PeerInfo node is connected to
     192 * @param pInfo the PeerInfo to remove
     193 */
     194void NetworkMonitor::removeNode(NetworkNode* node, PeerInfo* pInfo)
     195{
     196  if( node == NULL || pInfo == NULL)
     197    return;
     198
     199  if( pInfo->isClient())
     200    node->removeClient(pInfo);
     201  else if( pInfo->isProxyServerActive())
     202    node->removeActiveProxyServer(pInfo);
     203  else if( pInfo->isMasterServer())
     204    node->removeMasterServer(pInfo);
     205}
     206
     207
    178208/**
    179209 * @returns the proxy server of the first choice
  • branches/proxy/src/lib/network/monitor/network_monitor.h

    r9584 r9586  
    5050    inline void addMasterServer(NetworkNode* node, PeerInfo* pInfo) { node->addMasterServer(pInfo); }
    5151
     52    void removeNode(PeerInfo* pInfo);
     53    void removeNode(NetworkNode* node, PeerInfo* pInfo);
     54
    5255    inline void removeClient(NetworkNode* node, PeerInfo* pInfo) { node->removeClient(pInfo); }
    5356    inline void removeActiveProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->removeActiveProxyServer(pInfo); }
     
    7679
    7780    inline const std::list<NetworkNode*>& getNodeList() const { return this->nodeList; };
     81    /** @param userId of the searched node @returns the PeerInfo of the userId peer */
    7882    inline PeerInfo* getPeerByUserId( int userId) { return this->localNode->getPeerByUserId(userId); }
     83
    7984
    8085    void toggleGUI();
  • branches/proxy/src/lib/network/proxy/proxy_control.cc

    r9585 r9586  
    134134  pInfo->ip = IP(ipHost, 9999);
    135135  pInfo->nodeType = NET_CLIENT;
     136  pInfo->userId = newClientId;
    136137  netMon->addNode(pInfo);
    137138
     
    142143    // we now create the new player ship and stuff...
    143144    NetworkGameManager::getInstance()->signalNewPlayer(newClientId);
    144   }
    145   else if(SharedNetworkData::getInstance()->isProxyServerActive())
    146   {
    147 
    148145  }
    149146
     
    194191  assert( Converter::byteArrayToInt( data, &leaveClientId) == INTSIZE );
    195192
     193  // remove the node from the network monitor
     194  NetworkMonitor* netMon = SharedNetworkData::getInstance()->getNetworkMonitor();
     195  netMon->removeNode( netMon->getPeerByUserId(leaveClientId));
     196
    196197  PRINTF(0)("Got Signal: from %i new player left with userId: %i\n", senderId, leaveClientId);
    197198  // part for the master server
Note: See TracChangeset for help on using the changeset viewer.