提交 4deed5f3 编写于 作者: N Nikolay Shirokovskiy 提交者: Michal Privoznik

rpc: fix propagation of errors from server

Stream server error is not propagated if thread does not have the buck.
In case we have the buck we are ok due to the code added in [1].

Let's check for stream error on all paths. Now we don't need
to raise error in virNetClientCallDispatchStream.

Old code reported error only if the first message in wait
queue awaits reply. It is odd as depends on wait queue
situation. For example if we have only TX
message in queue and in one iteration loop both send the
message and receive error then thread sending TX message did
not receive the error. Next if we have RX message (first)
and TX message (second) in queue and in one iteration
loop both send the TX message and receive error then
thread sending TX message received error. In short
it was inconsistent. Let's report error whenever
we received it and for every type of message as it makes
sense to report errors as early as possible.

[1] 16c6e2b4: Fix propagation of RPC errors from streams
Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
上级 6709479a
......@@ -1230,9 +1230,6 @@ static int virNetClientCallDispatchStream(virNetClientPtr client)
if (thecall && thecall->expectReply) {
VIR_DEBUG("Got a synchronous error");
/* Raise error now, so that this call will see it immediately */
if (!virNetClientStreamRaiseError(st))
VIR_DEBUG("unable to raise synchronous error");
thecall->mode = VIR_NET_CLIENT_MODE_COMPLETE;
}
return 0;
......@@ -1947,16 +1944,11 @@ static int virNetClientIO(virNetClientPtr client,
*/
virNetClientIOUpdateCallback(client, false);
virResetLastError();
rv = virNetClientIOEventLoop(client, thiscall);
if (client->sock)
virNetClientIOUpdateCallback(client, true);
if (rv == 0 &&
virGetLastErrorCode())
rv = -1;
cleanup:
VIR_DEBUG("All done with our call head=%p call=%p rv=%d",
client->waitDispatch, thiscall, rv);
......@@ -2213,6 +2205,9 @@ int virNetClientSendStream(virNetClientPtr client,
if (virNetClientSendInternal(client, msg, expectReply, false) < 0)
goto cleanup;
if (virNetClientStreamRaiseError(st))
goto cleanup;
ret = 0;
cleanup:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册