From 0fecef8aa8c21bde369bda439bad1cd98e2fd4b3 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Thu, 5 May 2011 19:39:48 +0000 Subject: [PATCH] new version number, added code for sending disconnect messages if a server was not correctly disconnected --- ChangeLog | 11 +++++++++-- src/client.cpp | 6 +----- src/global.h | 2 +- src/protocol.cpp | 6 ++++++ src/socket.cpp | 20 +++++++++++++++++--- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1695b8b2..8134c649 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,19 @@ -3.1.3 +4.0.0 - new GUI style of the main window, added switch for selecting the GUI style in the settings window -- ini-file is stored in the home directory instead of the application directory +- a list of available servers is shown on pressing the connect button, the list + is managed by a central server, any private server is added automatically if + the registering setting is enabled - the Qt project file is now used for Linux, too +- ini-file is stored in the home directory instead of the application directory + +- added server settings in the GUI for the server list and added ini file + support to store the settings + 3.1.2 diff --git a/src/client.cpp b/src/client.cpp index 3f067b70..ae71a2d6 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -435,11 +435,7 @@ void CClient::Stop() // receive mechanism with the next command, we do not evaluate any // respond from the server, therefore we just hope that the message // gets its way to the server, if not, the old behaviour time-out - // disconnects the connection anyway. Send the message three times - // to increase the probability that at least one message makes it - // through). - Channel.CreateAndImmSendDisconnectionMes(); - Channel.CreateAndImmSendDisconnectionMes(); + // disconnects the connection anyway). Channel.CreateAndImmSendDisconnectionMes(); // disable channel diff --git a/src/global.h b/src/global.h index 6d820ca2..79b1b869 100755 --- a/src/global.h +++ b/src/global.h @@ -43,7 +43,7 @@ // version and application name (always use this version) #undef VERSION -#define VERSION "3.1.3cvs" +#define VERSION "4.0.0cvs" #define APP_NAME "llcon" // default names of the ini-file for client and server diff --git a/src/protocol.cpp b/src/protocol.cpp index c7bdb629..80c0587f 100755 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -574,6 +574,12 @@ bool CProtocol::ParseConnectionLessMessage ( const CVector& vecbyData, if ( !ParseMessageFrame ( vecbyData, iNumBytes, iRecCounter, iRecID, vecData ) ) { + +/* +// TEST channel implementation: randomly delete protocol messages (50 % loss) +if ( rand() < ( RAND_MAX / 2 ) ) return false; +*/ + if ( IsConnectionLessMessageID ( iRecID ) ) { // check which type of message we received and do action diff --git a/src/socket.cpp b/src/socket.cpp index 20d469a4..0099c16f 100755 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -127,9 +127,23 @@ void CSocket::OnDataReceived() { // this is an unknown address, try to parse connection less // message - pConnLessProtocol->ParseConnectionLessMessage ( vecbyRecBuf, - iNumBytesRead, - RecHostAddr ); + if ( pConnLessProtocol->ParseConnectionLessMessage ( vecbyRecBuf, + iNumBytesRead, + RecHostAddr ) ) + { + // message coult not be parsed, check if the packet comes + // from the server we just connected -> if yes, send + // disconnect message since the server may not know that we + // are not connected anymore + if ( pChannel->GetAddress() == RecHostAddr ) + { + // the channel has to be enabled for sending a message, + // disable the channel again afterwards + pChannel->SetEnable ( true ); + pChannel->CreateAndImmSendDisconnectionMes(); + pChannel->SetEnable ( false ); + } + } // do not perform any other action on this received packet return;