adopt readbuf do service

Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
Andy Green 2016-02-27 11:42:22 +08:00
parent 38a1cbb498
commit 701d8e8c43
2 changed files with 18 additions and 0 deletions

View file

@ -856,7 +856,9 @@ lws_adopt_socket_readbuf(struct lws_context *context, lws_sockfd_type accept_fd,
const char *readbuf, size_t len)
{
struct lws *wsi = lws_adopt_socket(context, accept_fd);
struct lws_context_per_thread *pt;
struct allocated_headers *ah;
struct lws_pollfd *pfd;
if (!wsi)
return NULL;
@ -880,6 +882,16 @@ lws_adopt_socket_readbuf(struct lws_context *context, lws_sockfd_type accept_fd,
ah->rxpos = 0;
ah->rxlen = len;
pt = &context->pt[(int)wsi->tsi];
/* unlike a normal connect, we have the headers already
* (or the first part of them anyway)
*/
pfd = &pt->fds[wsi->position_in_fds_table];
pfd->revents |= LWS_POLLIN;
lwsl_err("%s: calling service\n", __func__);
lws_service_fd_tsi(context, pfd, wsi->tsi);
return wsi;
}
@ -1047,6 +1059,9 @@ try_pollout:
goto fail;
}
if (!wsi->hdr_parsing_completed)
break;
if (wsi->state != LWSS_HTTP_ISSUING_FILE) {
n = user_callback_handle_rxflow(wsi->protocol->callback,
wsi, LWS_CALLBACK_HTTP_WRITEABLE,

View file

@ -237,6 +237,9 @@ user_service:
return 1;
}
if (!wsi->hdr_parsing_completed)
return 0;
#ifdef LWS_USE_HTTP2
/*
* we are the 'network wsi' for potentially many muxed child wsi with