force ssl rw bios nonblocking 71/2971/1
authorAndy Green <andy.green@linaro.org>
Mon, 28 Jan 2013 09:45:34 +0000 (17:45 +0800)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Thu, 7 Mar 2013 21:01:29 +0000 (13:01 -0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/server.c

index 03c0a26..6f8e437 100644 (file)
@@ -143,6 +143,7 @@ int lws_server_socket_service(struct libwebsocket_context *context,
        int m;
        int opt = 1;
        ssize_t len;
+       BIO *bio;
 
        switch (wsi->mode) {
 
@@ -281,6 +282,17 @@ int lws_server_socket_service(struct libwebsocket_context *context,
 
                SSL_set_fd(new_wsi->ssl, accept_fd);
 
+               bio = SSL_get_rbio(new_wsi->ssl);
+               if (bio)
+                       BIO_set_nbio(bio, 1); /* nonblocking */
+               else
+                       lwsl_notice("NULL rbio\n");
+               bio = SSL_get_wbio(new_wsi->ssl);
+               if (bio)
+                       BIO_set_nbio(bio, 1); /* nonblocking */
+               else
+                       lwsl_notice("NULL rbio\n");
+
                /* 
                 * we are not accepted yet, but we need to enter ourselves
                 * as a live connection.  That way we can retry when more