bug fix: make sure that received binrpc reply is for the sent request

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@609 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Bogdan Pintea 18 years ago
parent 726e3e3ddc
commit b8facaa06d

@ -646,8 +646,16 @@ brpc_t *BrpcCtrlInterface::rpcExecute(brpc_t *req)
brpc_finish(req);
req = NULL;
}
if (! (rpl = brpc_recvfrom(serFd, &from, RX_TIMEOUT))) {
/* receive from queue until empty, if IDs do not match */
while ((rpl = brpc_recvfrom(serFd, &from, RX_TIMEOUT))) {
if (req->id == rpl->id)
break;
ERROR("received reply's ID (#%d) doesn't match request's - discarded (%d)",
brpc_id(rpl), brpc_id(req));
brpc_finish(rpl);
}
if (! rpl) {
ERROR("failed to get reply: %s [%d].\n", brpc_strerror(), brpc_errno);
closeSock(&serFd, &sndAddr);
goto end;

Loading…
Cancel
Save