Skip to content

Commit 5a100b9

Browse files
committed
Add creation of session-long TCP connection
1 parent 23e9c36 commit 5a100b9

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/client.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,7 @@ void CClient::OnClientIDReceived ( int iServerChanID )
10261026
{
10271027
// *** Make TCP connection
10281028
qDebug() << Q_FUNC_INFO << "need to make TCP connection for" << iClientID;
1029+
ConnLessProtocol.CreateCLClientIDMes ( Channel.GetAddress(), iClientID, PROTO_TCP_LONG ); // create persistent TCP connection
10291030
}
10301031

10311032
// allocate and map client-side channel 0
@@ -1059,6 +1060,8 @@ void CClient::OnCLTcpSupported ( CHostAddress InetAddr, int iID )
10591060
{
10601061
// *** Make TCP connection
10611062
qDebug() << Q_FUNC_INFO << "need to make TCP connection for" << iClientID;
1063+
Q_ASSERT ( InetAddr == Channel.GetAddress() );
1064+
ConnLessProtocol.CreateCLClientIDMes ( InetAddr, iClientID, PROTO_TCP_LONG ); // create persistent TCP connection
10621065
}
10631066
}
10641067

src/protocol.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,7 +2650,7 @@ bool CProtocol::EvaluateCLTcpSupportedMes ( const CHostAddress& InetAddr, const
26502650
return false; // no error
26512651
}
26522652

2653-
void CProtocol::CreateCLClientIDMes ( const CHostAddress& InetAddr, const int iChanID, CTcpConnection* pTcpConnection )
2653+
void CProtocol::CreateCLClientIDMes ( const CHostAddress& InetAddr, const int iChanID, enum EProtoMode eProtoMode )
26542654
{
26552655
int iPos = 0; // init position pointer
26562656

@@ -2660,7 +2660,7 @@ void CProtocol::CreateCLClientIDMes ( const CHostAddress& InetAddr, const int iC
26602660
// channel ID (1 byte)
26612661
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( iChanID ), 1 );
26622662

2663-
CreateAndImmSendConLessMessage ( PROTMESSID_CLM_CLIENT_ID, vecData, InetAddr, pTcpConnection );
2663+
CreateAndImmSendConLessMessage ( PROTMESSID_CLM_CLIENT_ID, vecData, InetAddr, nullptr, eProtoMode );
26642664
}
26652665

26662666
bool CProtocol::EvaluateCLClientIDMes ( const CHostAddress& InetAddr, const CVector<uint8_t>& vecData, CTcpConnection* pTcpConnection )

src/protocol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class CProtocol : public QObject
165165
void CreateCLChannelLevelListMes ( const CHostAddress& InetAddr, const CVector<uint16_t>& vecLevelList, const int iNumClients );
166166
void CreateCLRegisterServerResp ( const CHostAddress& InetAddr, const ESvrRegResult eResult );
167167
void CreateCLTcpSupportedMes ( const CHostAddress& InetAddr, const int iID );
168-
void CreateCLClientIDMes ( const CHostAddress& InetAddr, const int iChanID, CTcpConnection* pTcpConnection );
168+
void CreateCLClientIDMes ( const CHostAddress& InetAddr, const int iChanID, enum EProtoMode eProtoMode );
169169

170170
static int GetBodyLength ( const CVector<uint8_t>& vecbyData );
171171

0 commit comments

Comments
 (0)