provide socketfd at in param for LWS_CALLBACK_FILTER_NETWORK_CONNECTION
Signed-off-by: Edwin van den Oetelaar <oetelaar.automatisering@gmail.com>
Signed-off-by: Andy Green <andy.green@linaro.org>
diff --git a/changelog b/changelog
index b0afe64..9b76f08 100644
--- a/changelog
+++ b/changelog
@@ -16,6 +16,8 @@
- the external poll callbacks now get the socket descriptor coming from the
"in" parameter. The user parameter provides the user_space for the
wsi as it normally does on the other callbacks.
+ LWS_CALLBACK_FILTER_NETWORK_CONNECTION also has the socket descriptor
+ delivered by @in now instead of @user.
User api removal
diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h
index 779af2e..b7f43fc 100644
--- a/lib/libwebsockets.h
+++ b/lib/libwebsockets.h
@@ -456,7 +456,7 @@
* LWS_CALLBACK_FILTER_NETWORK_CONNECTION: called when a client connects to
* the server at network level; the connection is accepted but then
* passed to this callback to decide whether to hang up immediately
- * or not, based on the client IP. @user contains the connection
+ * or not, based on the client IP. @in contains the connection
* socket's descriptor. Return non-zero to terminate
* the connection before sending or receiving anything.
* Because this happens immediately after the network connection
diff --git a/lib/server.c b/lib/server.c
index 44e6222..ae580c8 100644
--- a/lib/server.c
+++ b/lib/server.c
@@ -246,7 +246,7 @@
if ((context->protocols[0].callback)(context, wsi,
LWS_CALLBACK_FILTER_NETWORK_CONNECTION,
- (void *)(long)accept_fd, NULL, 0)) {
+ NULL, (void *)(long)accept_fd, 0)) {
lwsl_debug("Callback denied network connection\n");
compatible_close(accept_fd);
break;
diff --git a/test-server/test-server.c b/test-server/test-server.c
index 8ab4cb1..ce2f61e 100644
--- a/test-server/test-server.c
+++ b/test-server/test-server.c
@@ -246,7 +246,7 @@
case LWS_CALLBACK_FILTER_NETWORK_CONNECTION:
#if 0
- libwebsockets_get_peer_addresses(context, wsi, (int)(long)user, client_name,
+ libwebsockets_get_peer_addresses(context, wsi, (int)(long)in, client_name,
sizeof(client_name), client_ip, sizeof(client_ip));
fprintf(stderr, "Received network connect from %s (%s)\n",