From d962f56fb64fe659671c6b6d10a3b8a7cafbf878 Mon Sep 17 00:00:00 2001 From: Nikolay Shirokovskiy Date: Thu, 7 Feb 2019 15:58:45 +0300 Subject: [PATCH] rpc: client: don't set incomingEOF on errors This mixing errors and EOF condition in one flag is odd. Instead let's check st->err.code where appropriate. Signed-off-by: Nikolay Shirokovskiy --- src/rpc/virnetclientstream.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c index 4738da2c3d..32349f0d42 100644 --- a/src/rpc/virnetclientstream.c +++ b/src/rpc/virnetclientstream.c @@ -86,7 +86,7 @@ virNetClientStreamEventTimerUpdate(virNetClientStreamPtr st) VIR_DEBUG("Check timer rx=%p cbEvents=%d", st->rx, st->cbEvents); - if (((st->rx || st->incomingEOF) && + if (((st->rx || st->incomingEOF || st->err.code != VIR_ERR_OK) && (st->cbEvents & VIR_STREAM_EVENT_READABLE)) || (st->cbEvents & VIR_STREAM_EVENT_WRITABLE)) { VIR_DEBUG("Enabling event timer"); @@ -108,7 +108,7 @@ virNetClientStreamEventTimer(int timer ATTRIBUTE_UNUSED, void *opaque) if (st->cb && (st->cbEvents & VIR_STREAM_EVENT_READABLE) && - (st->rx || st->incomingEOF)) + (st->rx || st->incomingEOF || st->err.code != VIR_ERR_OK)) events |= VIR_STREAM_EVENT_READABLE; if (st->cb && (st->cbEvents & VIR_STREAM_EVENT_WRITABLE)) @@ -272,7 +272,6 @@ int virNetClientStreamSetError(virNetClientStreamPtr st, st->err.int1 = err.int1; st->err.int2 = err.int2; - st->incomingEOF = true; virNetClientStreamEventTimerUpdate(st); ret = 0; -- GitLab