Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 444


Ignore:
Timestamp:
Dec 9, 2007, 7:02:16 PM (17 years ago)
Author:
scheusso
Message:

chatserver/client ok

Location:
code/branches/FICN/src/network
Files:
5 edited

Legend:

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

    r442 r444  
    173173ClientInformation *ClientInformation::findClient(ENetAddress *address, bool look_backwards){
    174174  ClientInformation *temp = this;
    175   while(temp!=0 && (temp->getPeer()->address.host!=address->host || temp->getPeer()->address.port != address->port))
     175  while(temp!=0){
     176    if(temp->head){
     177      temp = temp->next();
     178      continue;
     179    }
     180    if(temp->getPeer()->address.host==address->host && temp->getPeer()->address.port == address->port)
     181      break;
    176182    temp = temp->next();
     183  }
    177184  // returns 0 if nothing has been found
    178185  return temp;
  • code/branches/FICN/src/network/ClientInformation.h

    r436 r444  
    1414
    1515#include <enet/enet.h>
     16#include <iostream> //debug
    1617
    1718#define GAMESTATEID_INITIAL -1
  • code/branches/FICN/src/network/ConnectionManager.cc

    r442 r444  
    5555  ENetPacket *ConnectionManager::getPacket(int &clientID){
    5656    ENetAddress address;
    57     ENetPacket *packet=getPacket(address);
    58     clientID=head_->findClient(&address)->getID();
     57    ENetPacket *packet=getPacket(address);std::cout << "searching clientid " << head_->getID() << std::endl;
     58    ClientInformation *temp =head_->findClient(&address);
     59    std::cout << "searching clientid " << temp << std::endl;
     60    clientID=temp->getID();
    5961    return packet;
    6062  }
  • code/branches/FICN/src/network/Server.cc

    r442 r444  
    2222  Server::Server(){
    2323    packet_gen = PacketGenerator();
    24     clients = new ClientInformation();
     24    clients = new ClientInformation(true);
    2525    connection = new ConnectionManager(clients);
    2626    gamestates = new GameStateManager(clients);
     
    109109    int clientID=-1;
    110110    while(!connection->queueEmpty()){
     111      std::cout << "Client " << clientID << " sent: " << std::endl;
    111112      packet = connection->getPacket(clientID);
    112113      elaborate(packet, clientID);
  • code/branches/FICN/src/network/dummyserver3.cc

    r441 r444  
    2626void dummyserver3::loop(){
    2727  open();
    28   while(true)
     28  while(true){
    2929    tick();
     30  }
    3031}
    3132
Note: See TracChangeset for help on using the changeset viewer.