Drone now disconnects only if version is incompatible or if any other RPC is received before versionCheck() - for all other errors/failures, drone does not disconnect the connection with client

This commit is contained in:
Srivats P. 2014-07-06 11:26:26 +05:30
parent 9955d31b77
commit 57be4f3ada

View File

@ -219,6 +219,7 @@ void RpcConnection::on_clientSock_dataAvail()
::google::protobuf::Message *req, *resp; ::google::protobuf::Message *req, *resp;
PbRpcController *controller; PbRpcController *controller;
QString error; QString error;
bool disconnect = false;
// Do we have enough bytes for a msg header? // Do we have enough bytes for a msg header?
// If yes, peek into the header and get msg length // If yes, peek into the header and get msg length
@ -260,6 +261,7 @@ void RpcConnection::on_clientSock_dataAvail()
qDebug("server(%s): version compatibility check pending", qDebug("server(%s): version compatibility check pending",
__FUNCTION__); __FUNCTION__);
error = "version compatibility check pending"; error = "version compatibility check pending";
disconnect = true;
goto _error_exit; goto _error_exit;
} }
@ -347,7 +349,8 @@ _error_exit2:
isPending = true; isPending = true;
controller = new PbRpcController(NULL, NULL); controller = new PbRpcController(NULL, NULL);
controller->SetFailed(error); controller->SetFailed(error);
controller->TriggerDisconnect(); if (disconnect)
controller->TriggerDisconnect();
sendRpcReply(controller); sendRpcReply(controller);
return; return;
} }