libubus: reset ctx->sock.eof to fix reconnect issues
[project/ubus.git] / libubus-io.c
index 9320bf3..1075c65 100644 (file)
@@ -259,6 +259,7 @@ static bool alloc_msg_buf(struct ubus_context *ctx, int len)
                return false;
 
        ctx->msgbuf.data = ptr;
+       ctx->msgbuf_data_len = len;
        return true;
 }
 
@@ -371,6 +372,7 @@ int ubus_reconnect(struct ubus_context *ctx, const char *path)
                close(ctx->sock.fd);
        }
 
+       ctx->sock.eof = false;
        ctx->sock.fd = usock(USOCK_UNIX, path, NULL);
        if (ctx->sock.fd < 0)
                return UBUS_STATUS_CONNECTION_FAILED;