Skip to content

Commit bfee34b

Browse files
committed
Add support for sending Empty Message over TCP
1 parent 5850507 commit bfee34b

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/protocol.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,11 +2313,11 @@ bool CProtocol::EvaluateCLSendEmptyMesMes ( const CVector<uint8_t>& vecData )
23132313
return false; // no error
23142314
}
23152315

2316-
void CProtocol::CreateCLEmptyMes ( const CHostAddress& InetAddr )
2316+
void CProtocol::CreateCLEmptyMes ( const CHostAddress& InetAddr, CTcpConnection* pTcpConnection )
23172317
{
23182318
// special message: for this message there exist no Evaluate
23192319
// function
2320-
CreateAndImmSendConLessMessage ( PROTMESSID_CLM_EMPTY_MESSAGE, CVector<uint8_t> ( 0 ), InetAddr );
2320+
CreateAndImmSendConLessMessage ( PROTMESSID_CLM_EMPTY_MESSAGE, CVector<uint8_t> ( 0 ), InetAddr, pTcpConnection );
23212321
}
23222322

23232323
void CProtocol::CreateCLDisconnection ( const CHostAddress& InetAddr )

src/protocol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class CProtocol : public QObject
156156
void CreateCLRedServerListMes ( const CHostAddress& InetAddr, const CVector<CServerInfo> vecServerInfo );
157157
void CreateCLReqServerListMes ( const CHostAddress& InetAddr, enum EProtoMode eProtoMode );
158158
void CreateCLSendEmptyMesMes ( const CHostAddress& InetAddr, const CHostAddress& TargetInetAddr );
159-
void CreateCLEmptyMes ( const CHostAddress& InetAddr );
159+
void CreateCLEmptyMes ( const CHostAddress& InetAddr, CTcpConnection* pTcpConnection );
160160
void CreateCLDisconnection ( const CHostAddress& InetAddr );
161161
void CreateCLVersionAndOSMes ( const CHostAddress& InetAddr );
162162
void CreateCLReqVersionAndOSMes ( const CHostAddress& InetAddr );

src/server.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public slots:
359359
// only send empty message if not a directory
360360
if ( !ServerListManager.IsDirectory() )
361361
{
362-
ConnLessProtocol.CreateCLEmptyMes ( TargetInetAddr );
362+
ConnLessProtocol.CreateCLEmptyMes ( TargetInetAddr, nullptr );
363363
}
364364
}
365365

src/serverlist.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ void CServerListManager::OnTimerPingServerInList()
523523
for ( int iIdx = 1; iIdx < iCurServerListSize; iIdx++ )
524524
{
525525
// send empty message to keep NAT port open at registered server
526-
pConnLessProtocol->CreateCLEmptyMes ( ServerList[iIdx].HostAddr );
526+
pConnLessProtocol->CreateCLEmptyMes ( ServerList[iIdx].HostAddr, nullptr );
527527
}
528528
}
529529

@@ -925,7 +925,7 @@ void CServerListManager::OnTimerPingServers()
925925
{
926926
// send empty message to directory to keep NAT port open -> we do
927927
// not require any answer from the directory
928-
pConnLessProtocol->CreateCLEmptyMes ( DirectoryAddress );
928+
pConnLessProtocol->CreateCLEmptyMes ( DirectoryAddress, nullptr );
929929
}
930930
}
931931

src/testbench.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public slots:
230230
break;
231231

232232
case 22: // PROTMESSID_CLM_EMPTY_MESSAGE
233-
Protocol.CreateCLEmptyMes ( CurHostAddress );
233+
Protocol.CreateCLEmptyMes ( CurHostAddress, nullptr );
234234
break;
235235

236236
case 23: // PROTMESSID_CLM_DISCONNECTION

0 commit comments

Comments
 (0)