From 8c8a8e149dffbb8ddac2383ae36d01fd126c6337 Mon Sep 17 00:00:00 2001 From: Edwin van den Oetelaar <oetelaar.automatisering@gmail.com> Date: Wed, 20 Feb 2013 20:56:59 +0800 Subject: [PATCH] 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> --- changelog | 2 ++ lib/libwebsockets.h | 2 +- lib/server.c | 2 +- test-server/test-server.c | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/changelog b/changelog index b0afe64d..9b76f081 100644 --- a/changelog +++ b/changelog @@ -16,6 +16,8 @@ User api changes - 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 779af2ed..b7f43fc4 100644 --- a/lib/libwebsockets.h +++ b/lib/libwebsockets.h @@ -456,7 +456,7 @@ struct libwebsocket_extension; * 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 44e62225..ae580c86 100644 --- a/lib/server.c +++ b/lib/server.c @@ -246,7 +246,7 @@ int lws_server_socket_service(struct libwebsocket_context *context, 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 8ab4cb15..ce2f61e3 100644 --- a/test-server/test-server.c +++ b/test-server/test-server.c @@ -246,7 +246,7 @@ bail: 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", -- GitLab