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