minor fix wrt issue #42
This commit is contained in:
parent
b9087715bf
commit
295cc65dce
4 changed files with 6 additions and 4 deletions
|
@ -119,7 +119,7 @@ void AbstractClient::sendCommand(PendingCommand *pend)
|
|||
void AbstractClient::queuePendingCommand(PendingCommand *pend)
|
||||
{
|
||||
// This function is always called from the client thread via signal/slot.
|
||||
const int cmdId = nextCmdId++;
|
||||
const int cmdId = getNewCmdId();
|
||||
pend->getCommandContainer().set_cmd_id(cmdId);
|
||||
|
||||
pendingCommands.insert(cmdId, pend);
|
||||
|
|
|
@ -73,6 +73,7 @@ protected:
|
|||
QMap<int, PendingCommand *> pendingCommands;
|
||||
QString userName, password;
|
||||
void setStatus(ClientStatus _status);
|
||||
int getNewCmdId() { return nextCmdId++; }
|
||||
virtual void sendCommandContainer(const CommandContainer &cont) = 0;
|
||||
public:
|
||||
AbstractClient(QObject *parent = 0);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "pb/server_message.pb.h"
|
||||
#include "pb/event_server_identification.pb.h"
|
||||
|
||||
static const unsigned int protocolVersion = 14;
|
||||
static const unsigned int protocolVersion = 13;
|
||||
|
||||
RemoteClient::RemoteClient(QObject *parent)
|
||||
: AbstractClient(parent), timeRunning(0), lastDataReceived(0), messageInProgress(false), handshakeStarted(false), messageLength(0)
|
||||
|
@ -50,6 +50,7 @@ void RemoteClient::slotConnected()
|
|||
|
||||
// dirty hack to be compatible with v14 server
|
||||
sendCommandContainer(CommandContainer());
|
||||
getNewCmdId();
|
||||
// end of hack
|
||||
|
||||
setStatus(StatusAwaitingWelcome);
|
||||
|
|
|
@ -260,7 +260,7 @@ void Server_ProtocolHandler::processCommandContainer(const CommandContainer &con
|
|||
{
|
||||
lastDataReceived = timeRunning;
|
||||
|
||||
ResponseContainer responseContainer(cont.cmd_id());
|
||||
ResponseContainer responseContainer(cont.has_cmd_id() ? cont.cmd_id() : -1);
|
||||
Response::ResponseCode finalResponseCode;
|
||||
|
||||
if (cont.game_command_size())
|
||||
|
@ -276,7 +276,7 @@ void Server_ProtocolHandler::processCommandContainer(const CommandContainer &con
|
|||
else
|
||||
finalResponseCode = Response::RespInvalidCommand;
|
||||
|
||||
if (finalResponseCode != Response::RespNothing)
|
||||
if ((finalResponseCode != Response::RespNothing))
|
||||
sendResponseContainer(responseContainer, finalResponseCode);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue