From 3b8a04a82972aabcee0c7de4f3074551bfb2bbdd Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Tue, 24 May 2011 18:44:51 +0000 Subject: [PATCH] use different ping message for server list ping --- src/client.h | 13 +++++++++++-- src/connectdlg.cpp | 2 +- src/connectdlg.h | 2 +- src/llconclientdlg.cpp | 4 ++-- src/llconclientdlg.h | 4 ++-- src/protocol.cpp | 5 +++-- src/protocol.h | 4 ++-- src/server.cpp | 4 ++-- src/server.h | 4 +++- 9 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/client.h b/src/client.h index 1373270e..1d073b27 100755 --- a/src/client.h +++ b/src/client.h @@ -227,8 +227,17 @@ public: void CreatePingMes() { Channel.CreatePingMes ( PreparePingMessage() ); } - void CreateCLPingMes ( const CHostAddress& InetAddr ) - { ConnLessProtocol.CreateCLPingMes ( InetAddr, PreparePingMessage() ); } +// TODO +//void CreateCLPingMes ( const CHostAddress& InetAddr ) +// { ConnLessProtocol.CreateCLPingMes ( InetAddr, PreparePingMessage() ); } + + + void CreateCLServerListPingMes ( const CHostAddress& InetAddr ) + { + ConnLessProtocol.CreateCLPingWithNumClientsMes ( InetAddr, + PreparePingMessage(), + 0 /* dummy */ ); + } void CreateCLReqServerListMes ( const CHostAddress& InetAddr ) { ConnLessProtocol.CreateCLReqServerListMes ( InetAddr ); } diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index 24b60ab8..340896c9 100755 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -351,7 +351,7 @@ void CConnectDlg::OnTimerPing() CurServerAddress ) ) { // if address is valid, send ping - emit CreateCLPingMes ( CurServerAddress ); + emit CreateCLServerListPingMes ( CurServerAddress ); } } } diff --git a/src/connectdlg.h b/src/connectdlg.h index d82f1f23..06191028 100755 --- a/src/connectdlg.h +++ b/src/connectdlg.h @@ -97,5 +97,5 @@ public slots: signals: void ReqServerListQuery ( CHostAddress InetAddr ); - void CreateCLPingMes ( CHostAddress InetAddr ); + void CreateCLServerListPingMes ( CHostAddress InetAddr ); }; diff --git a/src/llconclientdlg.cpp b/src/llconclientdlg.cpp index ab838864..1fe61efb 100755 --- a/src/llconclientdlg.cpp +++ b/src/llconclientdlg.cpp @@ -399,8 +399,8 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QObject::connect ( &ConnectDlg, SIGNAL ( ReqServerListQuery ( CHostAddress ) ), this, SLOT ( OnReqServerListQuery ( CHostAddress ) ) ); - QObject::connect ( &ConnectDlg, SIGNAL ( CreateCLPingMes ( CHostAddress ) ), - this, SLOT ( OnCreateCLPingMes ( CHostAddress ) ) ); + QObject::connect ( &ConnectDlg, SIGNAL ( CreateCLServerListPingMes ( CHostAddress ) ), + this, SLOT ( OnCreateCLServerListPingMes ( CHostAddress ) ) ); // Timers ------------------------------------------------------------------ diff --git a/src/llconclientdlg.h b/src/llconclientdlg.h index 37d210ab..d8643179 100755 --- a/src/llconclientdlg.h +++ b/src/llconclientdlg.h @@ -153,8 +153,8 @@ public slots: void OnReqServerListQuery ( CHostAddress InetAddr ) { pClient->CreateCLReqServerListMes ( InetAddr ); } - void OnCreateCLPingMes ( CHostAddress InetAddr ) - { pClient->CreateCLPingMes ( InetAddr ); } + void OnCreateCLServerListPingMes ( CHostAddress InetAddr ) + { pClient->CreateCLServerListPingMes ( InetAddr ); } void OnCLServerListReceived ( CHostAddress InetAddr, CVector vecServerInfo ) diff --git a/src/protocol.cpp b/src/protocol.cpp index 460b99d4..74085784 100755 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -147,8 +147,9 @@ CONNECTION LESS MESSAGES - PROTMESSID_CLM_PING_MS: Connection less ping message (for measuring the ping time) - note: same definition as PROTMESSID_PING_MS - + +-----------------------------+ + | 4 bytes transmit time in ms | + +-----------------------------+ - PROTMESSID_CLM_PING_MS_WITHNUMCLIENTS: Connection less ping message (for diff --git a/src/protocol.h b/src/protocol.h index 5d388945..0572eb0f 100755 --- a/src/protocol.h +++ b/src/protocol.h @@ -99,8 +99,8 @@ public: void CreateCLPingMes ( const CHostAddress& InetAddr, const int iMs ); void CreateCLPingWithNumClientsMes ( const CHostAddress& InetAddr, - const int iMs, - const int iNumClients ); + const int iMs, + const int iNumClients ); void CreateCLServerFullMes ( const CHostAddress& InetAddr ); void CreateCLRegisterServerMes ( const CHostAddress& InetAddr, const CServerCoreInfo& ServerInfo ); diff --git a/src/server.cpp b/src/server.cpp index f6967a17..a35a1b61 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -285,8 +285,8 @@ CServer::CServer ( const int iNewNumChan, this, SLOT ( OnSendCLProtMessage ( CHostAddress, CVector ) ) ); QObject::connect ( &ConnLessProtocol, - SIGNAL ( CLPingReceived ( CHostAddress, int ) ), - this, SLOT ( OnCLPingReceived ( CHostAddress, int ) ) ); + SIGNAL ( CLPingWithNumClientsReceived ( CHostAddress, int, int ) ), + this, SLOT ( OnCLPingWithNumClientsReceived ( CHostAddress, int, int ) ) ); QObject::connect ( &ConnLessProtocol, SIGNAL ( CLRegisterServerReceived ( CHostAddress, CServerCoreInfo ) ), diff --git a/src/server.h b/src/server.h index deffc57a..500b9578 100755 --- a/src/server.h +++ b/src/server.h @@ -249,7 +249,9 @@ public slots: const int iNumBytes, const CHostAddress& InetAddr ); - void OnCLPingReceived ( CHostAddress InetAddr, int iMs ) + void OnCLPingWithNumClientsReceived ( CHostAddress InetAddr, + int iMs, + int ) { ConnLessProtocol.CreateCLPingWithNumClientsMes ( InetAddr, iMs,