Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1433 for code


Ignore:
Timestamp:
May 26, 2008, 10:10:55 PM (16 years ago)
Author:
scheusso
Message:

clientinformation is now not threadsafe anymore (not neccessary and faster)

Location:
code/branches/network/src/network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/network/ClientInformation.cc

    r1431 r1433  
    4545namespace network
    4646{
    47   boost::recursive_mutex ClientInformation::mutex_;
    4847 
    4948  ClientInformation::ClientInformation() {
     
    8483
    8584  ClientInformation::~ClientInformation() {
    86     boost::recursive_mutex::scoped_lock lock(mutex_);
    8785    if(prev()!=0)
    8886      prev()->setNext(this->next());
     
    9290
    9391  ClientInformation *ClientInformation::next() {
    94     boost::recursive_mutex::scoped_lock lock(mutex_);
    9592    if(this!=0)
    9693      return this->nexte;
     
    9996  }
    10097  ClientInformation *ClientInformation::prev() {
    101     boost::recursive_mutex::scoped_lock lock(mutex_);
    10298    if(this!=0)
    10399      return this->preve;
     
    107103
    108104  bool ClientInformation::setPrev(ClientInformation *prev) {
    109     boost::recursive_mutex::scoped_lock lock(mutex_);
    110105    if(!head_)
    111106      this->preve = prev;
     
    116111
    117112  bool ClientInformation::setNext(ClientInformation *next) {
    118     boost::recursive_mutex::scoped_lock lock(mutex_);
    119113    this->nexte = next;
    120114    return true;
     
    122116
    123117  ClientInformation *ClientInformation::insertAfter(ClientInformation *ins) {
    124     boost::recursive_mutex::scoped_lock lock(mutex_);
    125118    this->next()->setPrev(ins);
    126119    ins->setNext(this->next());
     
    131124
    132125  ClientInformation *ClientInformation::insertBefore(ClientInformation *ins){
    133     boost::recursive_mutex::scoped_lock lock(mutex_);
    134126    if(!this)
    135127      return NULL;
     
    144136    if(!this)
    145137      return;
    146     boost::recursive_mutex::scoped_lock lock(mutex_);
    147138    clientID_ = clientID;
    148139  }
    149140
    150141  bool ClientInformation::setPeer(ENetPeer *peer){
    151     boost::recursive_mutex::scoped_lock lock(mutex_);
    152142    if(!this)
    153143      return false;
     
    157147
    158148  bool ClientInformation::setGameStateID(int id){
    159     boost::recursive_mutex::scoped_lock lock(mutex_);
    160149    if(!this)
    161150      return false;
     
    165154 
    166155  bool ClientInformation::setPartialGamestateID(int id){
    167     boost::recursive_mutex::scoped_lock lock(mutex_);
    168156    if(!this)
    169157      return false;
     
    173161
    174162  int ClientInformation::getID() {
    175     boost::recursive_mutex::scoped_lock lock(mutex_);
    176163    if(!this)
    177164      return CLIENTID_UNKNOWN;
     
    181168
    182169  ENetPeer *ClientInformation::getPeer() {
    183     boost::recursive_mutex::scoped_lock lock(mutex_);
    184170    if(this)
    185171      return peer_;
     
    189175 
    190176  bool ClientInformation::getHead(){
    191     boost::recursive_mutex::scoped_lock lock(mutex_);
    192177    return head_;
    193178  }
    194179 
    195180  void ClientInformation::setHead(bool h){
    196     boost::recursive_mutex::scoped_lock lock(mutex_);
    197181    head_=h;
    198182  }
    199183 
    200184  int ClientInformation::getFailures(){
    201     boost::recursive_mutex::scoped_lock lock(mutex_);
    202185    return failures_;
    203186  }
    204187  void ClientInformation::addFailure(){
    205     boost::recursive_mutex::scoped_lock lock(mutex_);
    206188    failures_++;
    207189  }
    208190  void ClientInformation::resetFailures(){
    209     boost::recursive_mutex::scoped_lock lock(mutex_);
    210191    failures_=0;
    211192  }
    212193
    213194  int ClientInformation::getGamestateID() {
    214     boost::recursive_mutex::scoped_lock lock(mutex_);
    215195    if(this)
    216196      return gamestateID_;
     
    220200 
    221201  int ClientInformation::getPartialGamestateID() {
    222     boost::recursive_mutex::scoped_lock lock(mutex_);
    223202    if(this)
    224203      return partialGamestateID_;
     
    228207
    229208  ClientInformation *ClientInformation::insertBack(ClientInformation *ins) {
    230     boost::recursive_mutex::scoped_lock lock(mutex_);
    231209    if(!this)
    232210      return NULL;
     
    241219
    242220  bool ClientInformation::removeClient(int clientID) {
    243     boost::recursive_mutex::scoped_lock lock(mutex_);
    244221    if(!this || clientID==CLIENTID_UNKNOWN)
    245222      return false;
     
    254231
    255232  bool ClientInformation::removeClient(ENetPeer *peer) {
    256     boost::recursive_mutex::scoped_lock lock(mutex_);
    257233    if(!this || !peer)
    258234      return false;
     
    277253  */
    278254  ClientInformation *ClientInformation::findClient(int clientID, bool look_backwards) {
    279     boost::recursive_mutex::scoped_lock lock(mutex_);
    280255    ClientInformation *temp = this;
    281256    if (temp->head_)
     
    295270  */
    296271  ClientInformation *ClientInformation::findClient(ENetAddress *address, bool look_backwards) {
    297     boost::recursive_mutex::scoped_lock lock(mutex_);
    298272    ClientInformation *temp = this;
    299273    while(temp!=0){
     
    311285
    312286  bool ClientInformation::setSynched(bool s) {
    313     boost::recursive_mutex::scoped_lock lock(mutex_);
    314287    if(!this)
    315288      return false;
     
    319292
    320293  bool ClientInformation::getSynched() {
    321     boost::recursive_mutex::scoped_lock lock(mutex_);
    322294    if(this)
    323295      return synched_;
  • code/branches/network/src/network/ClientInformation.h

    r1432 r1433  
    9797    bool setSynched(bool s);
    9898    bool getSynched();
    99     static boost::recursive_mutex mutex_;
    10099
    101100
  • code/branches/network/src/network/Server.cc

    r1431 r1433  
    215215  bool Server::sendGameState() {
    216216    COUT(5) << "Server: starting function sendGameState" << std::endl;
    217     boost::recursive_mutex::scoped_lock lock(clients->mutex_);
    218217    ClientInformation *temp = clients;
    219218    bool added=false;
Note: See TracChangeset for help on using the changeset viewer.