From 0a132164c2a2f8801612ad1f11fa122b63088324 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 8 Mar 2024 06:44:20 +0000 Subject: [PATCH] h2: cleanly return if fd is -1 on custom close --- .../minimal-http-server-eventlib-custom/minimal-http-server.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/minimal-examples/http-server/minimal-http-server-eventlib-custom/minimal-http-server.c b/minimal-examples/http-server/minimal-http-server-eventlib-custom/minimal-http-server.c index e969fea2b..693ec1140 100644 --- a/minimal-examples/http-server/minimal-http-server-eventlib-custom/minimal-http-server.c +++ b/minimal-examples/http-server/minimal-http-server-eventlib-custom/minimal-http-server.c @@ -244,6 +244,10 @@ wsi_logical_close_custom(struct lws *wsi) { struct pt_eventlibs_custom *priv = (struct pt_eventlibs_custom *) lws_evlib_wsi_to_evlib_pt(wsi); + + if (lws_get_socket_fd(wsi) == LWS_SOCK_INVALID) + return 0; + return custom_poll_del_fd(priv->io_loop, lws_get_socket_fd(wsi)); }