Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9494 in orxonox.OLD for trunk/src/lib/network/proxy


Ignore:
Timestamp:
Jul 27, 2006, 10:44:28 AM (18 years ago)
Author:
bensch
Message:

merged the proxy back

Location:
trunk/src/lib/network/proxy
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/network/proxy/network_settings.cc

    r9406 r9494  
    4040  // suggest a good standard max players value
    4141  this->maxPlayer = 10;
    42 
    43 //   this->loadData();
    4442}
    4543
     
    5351
    5452  // remove all unused proxy data again
    55   for( int i = 0; i < this->proxies.size(); i++)
     53  for(unsigned int i = 0; i < this->proxies.size(); i++)
    5654  {
    57     IPaddress* ip = this->proxies.back();
     55    IP ip = this->proxies.back();
    5856    this->proxies.pop_back();
    59     delete ip;
    6057  }
    6158}
     
    104101
    105102  LoadParam(root, "max-player", this, NetworkSettings, setMaxPlayer);
     103  LoadParam(root, "max-player-saturation", this, NetworkSettings, setMaxPlayerSaturation);
    106104
    107105
     
    140138    return;
    141139
    142   IPaddress *ip = new IPaddress;
    143 
    144   SDLNet_ResolveHost( ip, proxyAddr.c_str(), 9999 );
    145 
    146   this->proxies.push_back(ip);
     140  this->proxies.push_back(IP(proxyAddr, 9999));
    147141}
    148142
  • trunk/src/lib/network/proxy/network_settings.h

    r9406 r9494  
    3737    inline void setMaxPlayer(int number) { this->maxPlayer = number; }
    3838    /** @returns teh max number of players */
    39     int getMaxPlayer() { return this->maxPlayer; }
     39    int getMaxPlayer() const { return this->maxPlayer; }
     40    /** sets the @param saturation: a threshold in percente when the proxy servers should be activated to be able to redirect the clients */
     41    inline void setMaxPlayerSaturation(float saturation) { this->maxPlayerSaturation = saturation; }
     42
    4043
    4144    void setMasterAddr(const std::string& masterAddr);
    4245    /** @returns the address of the master server read from the network config file */
    43     inline IP getMasterAddr() { return this->masterServer; }
     46    inline const IP& getMasterAddr() const { return this->masterServer; }
    4447
    4548    void setProxyAddr(const std::string& proxyAddr);
    4649    /** @returns the list of proxy servers from the init file */
    47     inline std::vector<IPaddress*>* getProxyList() { return &this->proxies; }
     50    inline std::vector<IP>* getProxyList() { return &this->proxies; }
    4851
    4952
     
    5356
    5457  private:
    55     static NetworkSettings*        singletonRef;            //!< Pointer to the only instance of this Class
     58    static NetworkSettings*      singletonRef;            //!< Pointer to the only instance of this Class
     59
    5660    int                          maxPlayer;               //!< maximal number of players
    57     std::vector<IPaddress*>      proxies;                 //!< all registered proxies
     61    float                        maxPlayerSaturation;     //!< the saturation level from where on the proxy server should be activated
     62
     63    std::vector<IP>              proxies;                 //!< all registered proxies
    5864    IP                           masterServer;            //!< master server ip address
    5965
Note: See TracChangeset for help on using the changeset viewer.