ssl_capable_read add context param
authorAndy Green <andy.green@linaro.org>
Thu, 9 Oct 2014 00:14:30 +0000 (08:14 +0800)
committerAndy Green <andy.green@linaro.org>
Thu, 9 Oct 2014 00:14:30 +0000 (08:14 +0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/client.c
lib/output.c
lib/private-libwebsockets.h
lib/server.c
lib/service.c
lib/ssl.c

index 3cff9a0..9a00dc6 100755 (executable)
@@ -402,7 +402,7 @@ int lws_client_socket_service(struct libwebsocket_context *context,
                len = 1;
                while (wsi->u.hdr.parser_state != WSI_PARSING_COMPLETE &&
                                                                      len > 0) {
-                       n = lws_ssl_capable_read(wsi, &c, 1);
+                       n = lws_ssl_capable_read(context, wsi, &c, 1);
                        lws_latency(context, wsi, "send lws_issue_raw", n, n == 1);
                        switch (n) {
                        case LWS_SSL_CAPABLE_ERROR:
index ffe4c3c..40bb143 100644 (file)
@@ -545,7 +545,8 @@ all_sent:
 }
 
 LWS_VISIBLE int
-lws_ssl_capable_read_no_ssl(struct libwebsocket *wsi, unsigned char *buf, int len)
+lws_ssl_capable_read_no_ssl(struct libwebsocket_context *context,
+                           struct libwebsocket *wsi, unsigned char *buf, int len)
 {
        int n;
 
index 9f9c63a..5c20b4c 100755 (executable)
@@ -960,7 +960,8 @@ enum lws_ssl_capable_status {
 #define LWS_SSL_ENABLED(context) (context->use_ssl)
 LWS_EXTERN int openssl_websocket_private_data_index;
 LWS_EXTERN int
-lws_ssl_capable_read(struct libwebsocket *wsi, unsigned char *buf, int len);
+lws_ssl_capable_read(struct libwebsocket_context *context,
+                    struct libwebsocket *wsi, unsigned char *buf, int len);
 
 LWS_EXTERN int
 lws_ssl_capable_write(struct libwebsocket *wsi, unsigned char *buf, int len);
@@ -993,7 +994,8 @@ lws_context_init_http2_ssl(struct libwebsocket_context *context);
 #endif
 
 LWS_EXTERN int
-lws_ssl_capable_read_no_ssl(struct libwebsocket *wsi, unsigned char *buf, int len);
+lws_ssl_capable_read_no_ssl(struct libwebsocket_context *context,
+                           struct libwebsocket *wsi, unsigned char *buf, int len);
 
 LWS_EXTERN int
 lws_ssl_capable_write_no_ssl(struct libwebsocket *wsi, unsigned char *buf, int len);
index 68ee481..9932b25 100644 (file)
@@ -668,7 +668,7 @@ int lws_server_socket_service(struct libwebsocket_context *context,
                /* any incoming data ready? */
 
                if (pollfd->revents & LWS_POLLIN) {
-                       len = lws_ssl_capable_read(wsi,
+                       len = lws_ssl_capable_read(context, wsi,
                                        context->service_buffer,
                                                       sizeof(context->service_buffer));
                        switch (len) {
index a914e34..5565709 100644 (file)
@@ -436,7 +436,7 @@ libwebsocket_service_fd(struct libwebsocket_context *context,
                if (!(pollfd->revents & LWS_POLLIN))
                        break;
 
-               eff_buf.token_len = lws_ssl_capable_read(wsi,
+               eff_buf.token_len = lws_ssl_capable_read(context->wsi,
                                context->service_buffer,
                                               sizeof(context->service_buffer));
                switch (eff_buf.token_len) {
index 89935f9..120aece 100644 (file)
--- a/lib/ssl.c
+++ b/lib/ssl.c
@@ -355,12 +355,13 @@ int lws_context_init_client_ssl(struct lws_context_creation_info *info,
 #endif
 
 LWS_VISIBLE int
-lws_ssl_capable_read(struct libwebsocket *wsi, unsigned char *buf, int len)
+lws_ssl_capable_read(struct libwebsocket_context *context,
+                    struct libwebsocket *wsi, unsigned char *buf, int len)
 {
        int n;
 
        if (!wsi->ssl)
-               return lws_ssl_capable_read_no_ssl(wsi, buf, len);
+               return lws_ssl_capable_read_no_ssl(context, wsi, buf, len);
        
        wsi->buffered_reads_pending = 0;