Changeset 1502 for code/trunk/src/network/ConnectionManager.h
- Timestamp:
- Jun 1, 2008, 3:54:20 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/network/ConnectionManager.h
r1293 r1502 48 48 #include <enet/enet.h> 49 49 #include <boost/thread/thread.hpp> 50 #include <boost/thread/recursive_mutex.hpp> 50 51 51 52 #include "PacketBuffer.h" … … 61 62 #define NETWORK_PORT 55556 62 63 #define NETWORK_MAX_CONNECTIONS 50 63 #define NETWORK_WAIT_TIMEOUT 5000 64 #define NETWORK_SEND_WAIT 5 64 #define NETWORK_WAIT_TIMEOUT 1 65 65 66 66 struct ClientList{ … … 74 74 ConnectionManager(); 75 75 ConnectionManager(ClientInformation *head); 76 ConnectionManager(ClientInformation *head, int port); 76 77 ConnectionManager(int port, const char *address, ClientInformation *head); 77 78 ConnectionManager(int port, std::string address, ClientInformation *head); 78 ENetPacket *getPacket(ENetAddress &address); // thread1 79 ENetPacket *getPacket(int &clientID); 79 //ENetPacket *getPacket(ENetAddress &address); // thread1 80 //ENetPacket *getPacket(int &clientID); 81 ENetEvent *getEvent(); 80 82 bool queueEmpty(); 81 83 void createListener(); … … 84 86 bool addPacket(ENetPacket *packet, int ID); 85 87 bool addPacketAll(ENetPacket *packet); 86 bool sendPackets(ENetEvent *event);88 // bool sendPackets(ENetEvent *event); 87 89 bool sendPackets(); 88 bool createClient(int clientID);90 //bool createClient(int clientID); 89 91 void disconnectClient(ClientInformation *client); 92 void syncClassid(int clientID); 93 bool sendWelcome(int clientID, int shipID, bool allowed); 90 94 91 95 private: 92 bool clientDisconnect(ENetPeer *peer);93 bool removeClient(int clientID);96 // bool clientDisconnect(ENetPeer *peer); 97 // bool removeClient(int clientID); 94 98 bool processData(ENetEvent *event); 95 bool addClient(ENetEvent *event);99 //bool addClient(ENetEvent *event); 96 100 void receiverThread(); 97 101 void disconnectClients(); 98 102 int getClientID(ENetPeer peer); 99 103 int getClientID(ENetAddress address); 100 void syncClassid(int clientID);101 104 ENetPeer *getClientPeer(int clientID); 102 bool createShip(ClientInformation *client);105 //bool createShip(ClientInformation *client); 103 106 bool removeShip(ClientInformation *client); 104 bool sendWelcome(int clientID, int shipID, bool allowed);105 107 bool addFakeConnectRequest(ENetEvent *ev); 106 108 PacketBuffer buffer; … … 114 116 115 117 boost::thread *receiverThread_; 118 static boost::recursive_mutex enet_mutex_; 116 119 // int getNumberOfClients(); 117 120 //functions to map what object every clients uses
Note: See TracChangeset
for help on using the changeset viewer.