ssl_capable_read add context param

Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
Andy Green 2014-10-09 08:14:30 +08:00
parent fe3e3e61ec
commit 1f5c9f0c31
6 changed files with 12 additions and 8 deletions

View file

@ -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:

View 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;

View file

@ -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);

View 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) {

View 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) {

View file

@ -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;