@@ -285,7 +285,12 @@ void CClient::OnSendCLProtMessage ( CHostAddress InetAddr, CVector<uint8_t> vecM
285285 InetAddr,
286286 nullptr ,
287287 &Channel,
288- eProtoMode == PROTO_TCP_ONCE ); // client connection, will self-delete on disconnect
288+ eProtoMode == PROTO_TCP_LONG ); // client connection, will self-delete on disconnect
289+
290+ if ( eProtoMode == PROTO_TCP_LONG )
291+ {
292+ Channel.SetTcpConnection ( pTcpConnection ); // link session connection with channel
293+ }
289294
290295 pTcpConnection->write ( (const char *) &( (CVector<uint8_t >) vecMessage )[0 ], vecMessage.Size () );
291296
@@ -1065,16 +1070,17 @@ void CClient::OnCLTcpSupported ( CHostAddress InetAddr, int iID )
10651070 }
10661071}
10671072
1068- void CClient::OnCLConnClientsListMesReceived ( CHostAddress InetAddr, CVector<CChannelInfo> vecChanInfo )
1073+ void CClient::OnCLConnClientsListMesReceived ( CHostAddress InetAddr, CVector<CChannelInfo> vecChanInfo, CTcpConnection* pTcpConnection )
10691074{
10701075 // test if we are receiving for the connect dialog or a connected session
1071- qDebug () << Q_FUNC_INFO << " Channel.IsConnected() =" << Channel.IsConnected ();
1072- if ( Channel.IsConnected () )
1076+ if ( pTcpConnection && pTcpConnection->IsSession () )
10731077 {
1078+ qDebug () << " - sending client list to client dialog" ;
10741079 OnConClientListMesReceived ( vecChanInfo ); // connected session
10751080 }
10761081 else
10771082 {
1083+ qDebug () << " - sending client list to connect dialog" ;
10781084 emit CLConnClientsListMesReceived ( InetAddr, vecChanInfo ); // connect dialog
10791085 }
10801086}
@@ -1108,6 +1114,14 @@ void CClient::Stop()
11081114 // stop audio interface
11091115 Sound.Stop ();
11101116
1117+ // close any session TCP connection
1118+ CTcpConnection* pTcpConnection = Channel.GetTcpConnection ();
1119+ if ( pTcpConnection )
1120+ {
1121+ Channel.SetTcpConnection ( nullptr );
1122+ pTcpConnection->disconnectFromHost ();
1123+ }
1124+
11111125 // disable channel
11121126 Channel.SetEnable ( false );
11131127
0 commit comments