libubus: add socket EOF handling to ubus_complete_request()
authorFelix Fietkau <nbd@openwrt.org>
Wed, 9 Dec 2015 17:35:07 +0000 (18:35 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 9 Dec 2015 17:35:07 +0000 (18:35 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
libubus-req.c

index bf19f3670ea5b215190dfcce125c358f616c72a4..416adaba2f9fca50225d9915b2512026a7b481f1 100644 (file)
@@ -160,6 +160,10 @@ int ubus_complete_request(struct ubus_context *ctx, struct ubus_request *req,
                ubus_poll_data(ctx, (unsigned int) timeout);
 
                uloop_cancelled = cancelled;
+               if (ctx->sock.eof) {
+                       ubus_set_req_status(req, UBUS_STATUS_CONNECTION_FAILED);
+                       break;
+               }
        }
        ctx->stack_depth--;
        if (ctx->stack_depth)