Thread: [Gcblue-commits] gcb_wx/include/network tcConnectionData.h,1.6,1.7 tcControlMessageHandler.h,1.5,1.6
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-04-08 01:54:20
|
Update of /cvsroot/gcblue/gcb_wx/include/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7286/include/network Modified Files: tcConnectionData.h tcControlMessageHandler.h tcMultiplayerInterface.h tcNetworkInterface.h Log Message: multiplayer work Index: tcMultiplayerInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcMultiplayerInterface.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcMultiplayerInterface.h 4 Mar 2005 00:46:15 -0000 1.18 --- tcMultiplayerInterface.h 8 Apr 2005 01:54:11 -0000 1.19 *************** *** 58,61 **** --- 58,62 ---- int alliance; ///< player's alliance unsigned timestamp; ///< time of last update + float ping_s; ///< value of last ping std::map<long, double> lastUpdate; ///< map of (obj id, update time) pairs *************** *** 108,111 **** --- 109,113 ---- void SendChatText(int destination, const std::string& message); void SendControlMessage(int destination, int messageCode, int param = 0); + void SendControlMessageUDP(int destination, int messageCode, int param = 0); void SendTestUDP(int destination, const std::string& message); void SendUpdateMessage(int destination, tcStream& stream); *************** *** 113,118 **** --- 115,123 ---- void SetEvtHandler(wxEvtHandler *eh); void SetName(const std::string& name); + void SetPingTime(int connectionId, float ping_s); void Update(); + unsigned updateCount; ///< elapsed time for last update + private: tcNetworkInterface *networkInterface; *************** *** 126,129 **** --- 131,135 ---- wxEvtHandler* evtHandler; ///< wxWidgets event handler for posting messages to application + void ClearMessageMap(); void DistributeChatText(); *************** *** 138,141 **** --- 144,148 ---- void UpdateObjectCommands(unsigned connIdx, bool updateUnack, bool clearNewCmdFlag); void UpdateObjects(); + void UpdatePing(); void UpdatePlayerInfo(); void UpdateSensorMaps(); Index: tcControlMessageHandler.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcControlMessageHandler.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcControlMessageHandler.h 8 Aug 2004 00:31:32 -0000 1.5 --- tcControlMessageHandler.h 8 Apr 2005 01:54:11 -0000 1.6 *************** *** 50,54 **** CM_STARTGAME = 2, CM_TIME = 3, ///< time message also includes time acceleratin/pause state ! CM_ALLIANCE = 4 }; --- 50,56 ---- CM_STARTGAME = 2, CM_TIME = 3, ///< time message also includes time acceleratin/pause state ! CM_ALLIANCE = 4, ! CM_PING = 5, ! CM_PONG = 6 ///< reply to ping }; Index: tcNetworkInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcNetworkInterface.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcNetworkInterface.h 8 Aug 2004 00:31:32 -0000 1.8 --- tcNetworkInterface.h 8 Apr 2005 01:54:11 -0000 1.9 *************** *** 69,76 **** --- 69,79 ---- void OpenConnection(wxString hostName); + const unsigned char* ReceiveMessage(int connectionId, int& messageId, unsigned& messageSize, int protocol = TCP); bool SendMessage(int connectionId, int messageId, unsigned messageSize, const unsigned char *data, int protocol = TCP); + + void SetPingTime(int connectionId, float ping_s); /// must be called regularly Index: tcConnectionData.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcConnectionData.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcConnectionData.h 8 Aug 2004 00:31:32 -0000 1.6 --- tcConnectionData.h 8 Apr 2005 01:54:11 -0000 1.7 *************** *** 46,50 **** static tcNetworkInterface *networkInterface; ///< pointer to network interface - wxSocketBase *socket; ///< socket associated with this connection wxString idString; ///< identifier string for source of message unsigned int timestamp; ///< start time (tcTime 30 Hz counter) for connection --- 46,49 ---- *************** *** 58,67 **** --- 57,76 ---- unsigned long writeCount; ///< number of bytes written to this connection + const wxIPV4address& GetPeerAddress() const; unsigned long GetReadCount() const; + wxSocketBase* GetSocket(); unsigned long GetWriteCount() const; + unsigned int GetReadCountSec() const; + unsigned int GetWriteCountSec() const; + float GetPingTime() const; + void ReadNextMessageTCP(); void ReadNextMessageUDP(unsigned int messageSize, unsigned char *buffer); + void SendTCP(unsigned int idx); void SendUDP(unsigned int idx, bool useAck = false); + void SetPingTime(float ping_s); + void SetSocket(wxSocketBase* sock); + void Update(); ///< read and write data from socket void WriteQueuedMessages(); *************** *** 69,73 **** --- 78,90 ---- tcConnectionData(); private: + wxSocketBase *socket; ///< socket associated with this connection tcMessage tempMessage; ///< message to use for temporary storage + unsigned long lastReadCount; ///< read count at last second mark + unsigned long lastWriteCount; ///< write count at last second mark + unsigned int readCount_sec; ///< bytes read over last full second + unsigned int writeCount_sec; ///< bytes written over last full second + float pingTime_s; ///< last ping time for this connection + wxIPV4address UDPaddress; + wxString peerName; void WriteTCP(); |