Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 25, 2011, 8:22:36 PM (13 years ago)
Author:
scheusso
Message:

merging network6 into trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/network/ServerConnection.cc

    r7801 r8327  
    3535
    3636#include "util/Debug.h"
    37 #include "ClientInformation.h"
     37#include <util/Sleep.h>
     38// #include "ClientInformation.h"
    3839
    3940namespace orxonox
     
    4445  {
    4546    this->bindAddress_ = new ENetAddress();
    46     memset(this->bindAddress_, 0, sizeof(ENetAddress));
     47//     memset(this->bindAddress_, 0, sizeof(ENetAddress));
    4748    this->bindAddress_->host = ENET_HOST_ANY;
    4849    this->bindAddress_->port = NETWORK_PORT;
     50    this->bindAddress_->scopeID = 0;
    4951  }
    5052
     
    104106  void ServerConnection::addPacket(ENetPacket *packet, unsigned int clientID, uint8_t channelID)
    105107  {
    106     if ( clientID == CLIENTID_UNKNOWN )
     108    if ( clientID == NETWORK_PEER_ID_BROADCAST )
    107109    {
    108110      broadcastPacket(packet, channelID);
     
    110112    else
    111113    {
    112       ClientInformation *temp = ClientInformation::findClient(clientID);
    113       if(!temp){
    114         COUT(3) << "C.Man: addPacket findClient failed" << std::endl;
    115       }
    116       Connection::addPacket(packet, temp->getPeer(), channelID);
     114//       ClientInformation *temp = ClientInformation::findClient(clientID);
     115//       if(!temp){
     116//         COUT(3) << "C.Man: addPacket findClient failed" << std::endl;
     117//       }
     118      Connection::addPacket(packet, clientID, channelID);
    117119    }
    118120  }
    119121
    120   void ServerConnection::disconnectClient(ClientInformation *client)
    121   {
    122     Connection::disconnectPeer( client->getPeer() );
    123   }
     122//   void ServerConnection::disconnectClient(ClientInformation *client)
     123//   {
     124//     Connection::disconnectPeer( client->getPeer() );
     125//   }
    124126
    125127  void ServerConnection::disconnectClient(int clientID)
    126128  {
    127     ClientInformation *client = ClientInformation::findClient(clientID);
    128     if(client)
    129       ServerConnection::disconnectClient(client);
     129//     ClientInformation *client = ClientInformation::findClient(clientID);
     130//     if(client)
     131    ServerConnection::disconnectClient(clientID);
    130132  }
    131133
    132134  void ServerConnection::disconnectClients()
    133135  {
    134     ClientInformation *temp = ClientInformation::getBegin();
    135     while(temp!=0)
    136     {
    137       ServerConnection::disconnectClient( temp );
    138       temp = temp->next();
    139     }
     136    Connection::disconnectPeers();
     137    Connection::waitOutgoingQueue();
    140138    return;
    141139  }
    142140
    143141
    144   int ServerConnection::getClientID(ENetPeer* peer)
    145   {
    146     return getClientID(&(peer->address));
    147   }
     142//   int ServerConnection::getClientID(ENetPeer* peer)
     143//   {
     144//     return getClientID(&(peer->address));
     145//   }
    148146
    149   int ServerConnection::getClientID(ENetAddress* address)
    150   {
    151     return ClientInformation::findClient(address)->getID();
    152   }
    153 
    154   ENetPeer *ServerConnection::getClientPeer(int clientID)
    155   {
    156     return ClientInformation::findClient(clientID)->getPeer();
    157   }
     147//   int ServerConnection::getClientID(ENetAddress* address)
     148//   {
     149//     return ClientInformation::findClient(address)->getID();
     150//   }
     151//
     152//   ENetPeer *ServerConnection::getClientPeer(int clientID)
     153//   {
     154//     return ClientInformation::findClient(clientID)->getPeer();
     155//   }
    158156
    159157
Note: See TracChangeset for help on using the changeset viewer.