Skip to content
Permalink
Browse files

ssl treat WANT_READ and WRITE separately

Signed-off-by: Andy Green <andy.green@linaro.org>
  • Loading branch information...
Andy Green
Andy Green committed Nov 24, 2015
1 parent 0a05792 commit 1728988efa97aefdcf6c4feb06877e460880cda2
Showing with 13 additions and 13 deletions.
  1. +13 −13 lib/client.c
@@ -215,8 +215,10 @@ int lws_client_socket_service(struct libwebsocket_context *context,
if (n < 0) {
n = SSL_get_error(wsi->ssl, n);

if (n == SSL_ERROR_WANT_READ ||
n == SSL_ERROR_WANT_WRITE) {
if (n == SSL_ERROR_WANT_READ)
goto some_wait;

if (n == SSL_ERROR_WANT_WRITE) {
/*
* wants us to retry connect due to
* state of the underlying ssl layer...
@@ -231,10 +233,10 @@ int lws_client_socket_service(struct libwebsocket_context *context,
*/

lwsl_info(
"SSL_connect WANT_... retrying\n");
"SSL_connect WANT_WRITE... retrying\n");
libwebsocket_callback_on_writable(
context, wsi);
some_wait:
wsi->mode = LWS_CONNMODE_WS_CLIENT_WAITING_SSL;

return 0; /* no error */
@@ -276,8 +278,10 @@ int lws_client_socket_service(struct libwebsocket_context *context,
if (n < 0) {
n = SSL_get_error(wsi->ssl, n);

if (n == SSL_ERROR_WANT_READ ||
n == SSL_ERROR_WANT_WRITE) {
if (n == SSL_ERROR_WANT_READ)
goto some_wait;

if (n == SSL_ERROR_WANT_WRITE) {
/*
* wants us to retry connect due to
* state of the underlying ssl layer...
@@ -291,14 +295,10 @@ int lws_client_socket_service(struct libwebsocket_context *context,
* us to get called back when writable.
*/

lwsl_info(
"SSL_connect WANT_... retrying\n");
libwebsocket_callback_on_writable(
context, wsi);

wsi->mode = LWS_CONNMODE_WS_CLIENT_WAITING_SSL;
lwsl_info("SSL_connect WANT_WRITE... retrying\n");
libwebsocket_callback_on_writable(context, wsi);

return 0; /* no error */
goto some_wait;
}
n = -1;
}

0 comments on commit 1728988

Please sign in to comment.
You can’t perform that action at this time.