Changeset 7565 in orxonox.OLD for branches/network/src/lib/network/network_stream.h
- Timestamp:
- May 10, 2006, 1:13:49 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/network_stream.h
r7540 r7565 9 9 #include <vector> 10 10 #include <list> 11 #include <map> 11 12 12 13 #include "data_stream.h" … … 22 23 class NetworkGameManager; 23 24 25 class PeerInfo 26 { 27 public: 28 PeerInfo() { clear(); } 29 void clear() { userId = 0; isServer = false; socket = NULL; handshake = NULL; lastAckedState = 0; lastRecvedState = 0; } 30 int userId; 31 bool isServer; 32 NetworkSocket * socket; 33 Handshake * handshake; 34 int lastAckedState; 35 int lastRecvedState; 36 }; 37 24 38 typedef std::list<Synchronizeable*> SynchronizeableList; 25 typedef std::vector<NetworkSocket*> NetworkSocketVector; 26 typedef std::vector<Handshake*> HandshakeVector; 39 typedef std::map<int,PeerInfo> PeerList; 27 40 28 41 … … 48 61 49 62 inline int getMaxConnections(){ return maxConnections; } 50 void setMaxConnections( int n );51 63 52 64 virtual void processData(); … … 56 68 int getSyncCount(); 57 69 58 inline bool isUserIdActive( int userID ) { if (userID>=networkSockets.size()) return false; else return networkSockets[userID]!=NULL; }70 inline bool isUserIdActive( int userID ) { return (peers.find(userID) != peers.end()); } 59 71 60 72 void debug(); 73 74 inline PeerInfo & getPeerInfo( int userId ) { return peers[userId]; } 61 75 62 76 63 77 private: 64 78 void updateConnectionList(); 79 void handleHandshakes(); 80 void handleUpstream(); 81 void handleDownstream(); 65 82 66 83 … … 69 86 ConnectionMonitor* connectionMonitor; 70 87 SynchronizeableList synchronizeables; 71 NetworkSocketVector networkSockets; 72 HandshakeVector handshakes; 88 PeerList peers; 73 89 ServerSocket* serverSocket; 74 90 int type; … … 79 95 int myHostId; 80 96 int maxConnections; 97 98 int currentState; 81 99 82 100 NetworkGameManager* networkGameManager;
Note: See TracChangeset
for help on using the changeset viewer.