From 1fca4b9b36dc1bb3c5ee7ec1ce6b5d74ffbfe29c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Fri, 16 Mar 2018 11:39:07 +0100 Subject: [PATCH] afb-websock: Fix double close MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Integration with newer versions of libmicrohttpd was closing two times the file descriptor: - one time by the websocket within afb - one time by the upgrade close of libmicrohttpd Thanks to 'autoclose' feature of 'fdev', the solution is quiet easily. Bug-AGL: SPEC-1345 Change-Id: Ifb691b3f69c095b5ff44bfd7f7267ea24d52df6d Signed-off-by: José Bollo --- src/afb-websock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/afb-websock.c b/src/afb-websock.c index 257bd193..fdfca9d7 100644 --- a/src/afb-websock.c +++ b/src/afb-websock.c @@ -31,6 +31,7 @@ #include "afb-websock.h" #include "afb-ws-json1.h" #include "afb-fdev.h" +#include "fdev.h" /**************** WebSocket connection upgrade ****************************/ @@ -150,6 +151,7 @@ static void upgrade_to_websocket( /* TODO */ close_websocket(urh); } else { + fdev_set_autoclose(fdev, 0); ws = memo->proto->create(fdev, memo->apiset, &memo->hreq->xreq.context, close_websocket, urh); if (ws == NULL) { /* TODO */ -- 2.16.6