Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 4, 2007, 8:22:24 PM (16 years ago)
Author:
scheusso
Message:

problem in connectionmanager

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/network/ConnectionManager.h

    r369 r380  
    1515#include <iostream>
    1616#include <string>
     17#include <map>
     18#include <vector>
    1719// enet library for networking support
    1820#include <enet/enet.h>
     
    2022#include <boost/thread/thread.hpp>
    2123#include <boost/bind.hpp>
    22 // headerfile
     24// headerfiles
    2325#include "ConnectionManager.h"
    2426#include "PacketBuffer.h"
     
    3032#define NETWORK_WAIT_TIMEOUT 5000
    3133#define NETWORK_SEND_WAIT 5
    32   //just some defines to make life easier ;)
    33 // #define ENetEvent std::ENetEvent
    34 // #define ENetHost std::ENetHost
    35 // #define ENetAddress std::ENetAddress
    36 // #define ENetPeer std::ENetPeer
    3734
    3835  struct ClientList{
     
    4845    ConnectionManager(int port, std::string address);
    4946    ENetPacket *getPacket(ENetAddress &address); // thread1
    50     // check wheter the packet queue is empty
     47    ENetPacket *getPacket(int &clientID);
    5148    bool queueEmpty();
    52     // create a new listener thread
    5349    void createListener();
    5450    bool quitListener();
    55     // add a packet to queue for a specific client peer
    5651    bool addPacket(ENetPacket *packet, ENetPeer *peer);
    57     // add ad packet to queue for a specific client ID
    5852    bool addPacket(ENetPacket *packet, int ID);
    59     // add a packet to queue for all clients
    6053    bool addPacketAll(ENetPacket *packet);
    61     // send out all queued packets
    6254    bool sendPackets(ENetEvent *event);
    6355    bool sendPackets();
    6456    private:
    6557    bool clientDisconnect(ENetPeer *peer);
     58    bool clientDisconnect(ENetPeer peer);
    6659    bool processData(ENetEvent *event);
    6760    bool addClient(ENetEvent *event);
    68     // implementation of the listener
    69     void receiverThread(); //thread2
     61    void receiverThread();
    7062    void disconnectClients();
    71     //packetbuffer
     63    int getClientID(ENetPeer peer);
     64    int getClientID(ENetAddress address);
     65    ENetPeer getClientPeer(int clientID);
    7266    PacketBuffer buffer;
    73     // enet stuff
     67   
    7468    ENetHost *server;
    7569    ENetAddress bindAddress;
    76     // quit-variable (communication with threads)
    77     bool quit;
    78     // clientlist
    79     ClientList *client;
    80 //     thread group
    81 //     boost::thread_group threads;
     70   
     71    bool quit; // quit-variable (communication with threads)
     72    std::map<ENetAddress, int> clientMap;
     73    std::map<ENetAddress, ENetPeer> peerMap;
     74    std::vector<ENetAddress> clientVector;
    8275  };
    8376
Note: See TracChangeset for help on using the changeset viewer.