provide socketfd at in param for LWS_CALLBACK_FILTER_NETWORK_CONNECTION 33/3133/1
authorEdwin van den Oetelaar <oetelaar.automatisering@gmail.com>
Wed, 20 Feb 2013 12:56:59 +0000 (20:56 +0800)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Thu, 7 Mar 2013 21:01:37 +0000 (13:01 -0800)
Signed-off-by: Edwin van den Oetelaar <oetelaar.automatisering@gmail.com>
Signed-off-by: Andy Green <andy.green@linaro.org>
changelog
lib/libwebsockets.h
lib/server.c
test-server/test-server.c

index b0afe64..9b76f08 100644 (file)
--- 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
index 779af2e..b7f43fc 100644 (file)
@@ -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
index 44e6222..ae580c8 100644 (file)
@@ -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;
index 8ab4cb1..ce2f61e 100644 (file)
@@ -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",