Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9290 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 14, 2006, 12:19:31 PM (18 years ago)
Author:
patrick
Message:

working with max connections

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

Legend:

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

    r9289 r9290  
    9999    this->localNode->addClient(pInfo);
    100100  else if( pInfo->isProxyServer())
     101  {
    101102    this->localNode->addProxyServer(pInfo);
     103    // create a new node, since a proxy can connect clients again
     104    NetworkNode* node = new NetworkNode(pInfo);
     105    this->nodeList.push_back(node);
     106  }
    102107  else if( pInfo->isMasterServer())
     108  {
    103109    this->localNode->addMasterServer(pInfo);
     110  }
    104111}
    105112
  • branches/proxy/src/lib/network/monitor/network_monitor.h

    r9287 r9290  
    5252    inline int getPlayerNumber() { return this->playerNumber; }
    5353
     54    /** @returns true if there are still free network slots available */
     55    inline bool gotFreeSlots() { return (this->playerNumber < NET_MAX_CONNECTIONS)?true:false; }
     56    void getServerWithFreeSlots() { }
     57
    5458
    5559    void showGUI();
  • branches/proxy/src/lib/network/netdefs.h

    r9263 r9290  
    3434
    3535/* maximal connectinons for the server*/
    36 #define MAX_CONNECTIONS 1000
     36#define NET_MAX_CONNECTIONS 5
    3737
    3838/* network polling frequency */
  • branches/proxy/src/lib/network/network_stream.cc

    r9287 r9290  
    337337
    338338    // check if there are too many clients connected
    339     if ( clientId > MAX_CONNECTIONS )
     339    if ( clientId > NET_MAX_CONNECTIONS )
    340340    {
    341341      peers[clientId].handshake->doReject( "too many connections" );
     
    420420               (*it)->getUniqueID(), (*it)->beSynchronized());
    421421  }
    422   PRINT(0)(" Maximal Connections: %i\n", MAX_CONNECTIONS );
     422  PRINT(0)(" Maximal Connections: %i\n", NET_MAX_CONNECTIONS );
    423423
    424424}
     
    568568
    569569      // server fakes uniqueid == 0 for handshake
    570       if ( this->isMasterServer() && sync.getUniqueID() < MAX_CONNECTIONS - 1 )
     570      if ( this->isMasterServer() && sync.getUniqueID() < NET_MAX_CONNECTIONS - 1 )
    571571        n = Converter::intToByteArray( 0, buf + offset, UDP_PACKET_SIZE - offset );
    572572      else
  • branches/proxy/src/lib/network/network_stream.h

    r9285 r9290  
    5252    inline bool isClient() const { return (this->pInfo->nodeType == NET_CLIENT)? true:false; }
    5353//     inline bool isActive() const { return this->bActive; }
    54     inline int getMaxConnections(){ return MAX_CONNECTIONS; }
     54    inline int getMaxConnections(){ return NET_MAX_CONNECTIONS; }
    5555
    5656    /* functions for the peerInfo information retreival */
  • branches/proxy/src/lib/network/peer_info.h

    r9286 r9290  
    3232    int                 userId;
    3333    int                 nodeType;
     34    IPaddress           ip;
     35
    3436    NetworkSocket *     socket;
    3537    Handshake *         handshake;
    3638    ConnectionMonitor * connectionMonitor;
     39
    3740    int                 lastAckedState;
    3841    int                 lastRecvedState;
  • branches/proxy/src/lib/network/shared_network_data.cc

    r9257 r9290  
    3535  this->hostID = -1;
    3636  this->defaultSyncStream = NULL;
    37   this->newUniqueID = MAX_CONNECTIONS + 2;
     37  this->newUniqueID = NET_MAX_CONNECTIONS + 2;
    3838  this->nodeType = NET_CLIENT;
    3939}
  • branches/proxy/src/lib/network/udp_socket.h

    r8802 r9290  
    3131
    3232    virtual void connectToServer( std::string host, int port );
    33    
     33
    3434    virtual void disconnectServer();
    3535
     
    3737
    3838    virtual int readPacket(byte * data, int maxLength);
    39    
     39
     40    IPaddress getAddress() { return this->ip; }
     41
     42
    4043  private:
    4144    UdpServerSocket * serverSocket;   //!< will get packets here
     
    4447    UDPsocket         socket;         //!< socket used to send/recieve
    4548    UDPpacket *       packet;
    46    
     49
    4750    byte              randomByte;     //!< contains random bytes & 0xFC
    48    
     51
    4952    bool writeRawPacket( byte * data, int length );
    5053    bool checkUdpCmd( byte udpCmd );
    5154    bool checkRandomByte( byte rndByte );
    5255    byte generateNewRandomByte();
    53    
     56
    5457    void init();
    5558
Note: See TracChangeset for help on using the changeset viewer.