Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 22, 2008, 4:24:32 PM (17 years ago)
Author:
scheusso
Message:

various enhancements with enet handling (serverside in
connectionmanager)

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

Legend:

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

    r1360 r1378  
    8585  ClientInformation::~ClientInformation() {
    8686    boost::recursive_mutex::scoped_lock lock(mutex_);
    87     if(preve!=0)
    88       preve->setNext(this->nexte);
    89     if(nexte!=0)
    90       nexte->setPrev(this->preve);
     87    if(next()!=0)
     88      prev()->setNext(this->next());
     89    if(next()!=0)
     90      next()->setPrev(this->prev());
    9191  }
    9292
     
    123123  ClientInformation *ClientInformation::insertAfter(ClientInformation *ins) {
    124124    boost::recursive_mutex::scoped_lock lock(mutex_);
    125     this->nexte->setPrev(ins);
    126     ins->setNext(this->nexte);
     125    this->next()->setPrev(ins);
     126    ins->setNext(this->next());
    127127    ins->setPrev(this);
    128128    this->nexte = ins;
     
    135135      return NULL;
    136136    this->prev()->setNext(ins);
    137     ins->setPrev(this->preve);
     137    ins->setPrev(this->prev());
    138138    this->preve=ins;
    139139    ins->setNext(this);
     
    142142
    143143  void ClientInformation::setID(int clientID){
     144    if(!this)
     145      return;
    144146    boost::recursive_mutex::scoped_lock lock(mutex_);
    145147    clientID_ = clientID;
  • code/branches/network/src/network/ConnectionManager.cc

    r1360 r1378  
    151151  }
    152152
    153   bool ConnectionManager::sendPackets(ENetEvent *event) {
     153  /*bool ConnectionManager::sendPackets(ENetEvent *event) {
    154154    if(server==NULL)
    155155      return false;
     
    158158    else
    159159      return false;
    160   }
     160  }*/
    161161
    162162  bool ConnectionManager::sendPackets() {
    163     ENetEvent event;
    164163    if(server==NULL)
    165164      return false;
    166     if(enet_host_service(server, &event, NETWORK_SEND_WAIT)>=0)
    167       return true;
    168     else
    169       return false;
     165    enet_host_flush(server);
     166    return true;
    170167  }
    171168
     
    208205          break;
    209206        case ENET_EVENT_TYPE_NONE:
    210           receiverThread_->yield();
     207          //receiverThread_->yield();
    211208          break;
    212209      }
    213210//       usleep(100);
    214       receiverThread_->yield(); //TODO: find apropriate
     211      //receiverThread_->yield(); //TODO: find apropriate
    215212    }
    216213    disconnectClients();
  • code/branches/network/src/network/ConnectionManager.h

    r1293 r1378  
    8484    bool addPacket(ENetPacket *packet, int ID);
    8585    bool addPacketAll(ENetPacket *packet);
    86     bool sendPackets(ENetEvent *event);
     86  //  bool sendPackets(ENetEvent *event);
    8787    bool sendPackets();
    8888    bool createClient(int clientID);
Note: See TracChangeset for help on using the changeset viewer.