clean test server a bit
authorAndy Green <andy.green@linaro.org>
Wed, 26 Nov 2014 04:04:29 +0000 (12:04 +0800)
committerAndy Green <andy.green@linaro.org>
Wed, 26 Nov 2014 04:04:29 +0000 (12:04 +0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
test-server/test-server.c

index 6183117..97493cc 100644 (file)
@@ -154,10 +154,6 @@ static int callback_http(struct libwebsocket_context *context,
                enum libwebsocket_callback_reasons reason, void *user,
                                                           void *in, size_t len)
 {
-#if 0
-       char client_name[128];
-       char client_ip[128];
-#endif
        char buf[256];
        char leaf_path[1024];
        char b64[64];
@@ -230,11 +226,18 @@ static int callback_http(struct libwebsocket_context *context,
                         */
                        if (lws_add_http_header_status(context, wsi, 200, &p, end))
                                return 1;
-                       if (lws_add_http_header_by_token(context, wsi, WSI_TOKEN_HTTP_SERVER, (unsigned char *)"libwebsockets", 13, &p, end))
+                       if (lws_add_http_header_by_token(context, wsi,
+                                       WSI_TOKEN_HTTP_SERVER,
+                                       (unsigned char *)"libwebsockets",
+                                       13, &p, end))
                                return 1;
-                       if (lws_add_http_header_by_token(context, wsi, WSI_TOKEN_HTTP_CONTENT_TYPE, (unsigned char *)"image/jpeg", 10, &p, end))
+                       if (lws_add_http_header_by_token(context, wsi,
+                                       WSI_TOKEN_HTTP_CONTENT_TYPE,
+                                       (unsigned char *)"image/jpeg",
+                                       10, &p, end))
                                return 1;
-                       if (lws_add_http_header_content_length(context, wsi,stat_buf.st_size, &p, end))
+                       if (lws_add_http_header_content_length(context, wsi,
+                                               stat_buf.st_size, &p, end))
                                return 1;
                        if (lws_finalize_http_header(context, wsi, &p, end))
                                return 1;
@@ -251,9 +254,9 @@ static int callback_http(struct libwebsocket_context *context,
                         */
 
                        n = libwebsocket_write(wsi,
-                                              buffer + LWS_SEND_BUFFER_PRE_PADDING,
-                                              p - (buffer + LWS_SEND_BUFFER_PRE_PADDING),
-                                              LWS_WRITE_HTTP_HEADERS);
+                                       buffer + LWS_SEND_BUFFER_PRE_PADDING,
+                                       p - (buffer + LWS_SEND_BUFFER_PRE_PADDING),
+                                       LWS_WRITE_HTTP_HEADERS);
 
                        if (n < 0) {
                                close(pss->fd);
@@ -428,13 +431,7 @@ bail:
         */
 
        case LWS_CALLBACK_FILTER_NETWORK_CONNECTION:
-#if 0
-               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",
-                                                       client_name, client_ip);
-#endif
                /* if we returned non-zero from here, we kill the connection */
                break;