trac 28 - differentiate between http serving and accepted http connection
Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
parent
502b9948f2
commit
7cf6cb00c2
4 changed files with 5 additions and 2 deletions
|
@ -138,7 +138,7 @@ libwebsocket_read(struct libwebsocket_context *context,
|
|||
/* union transition */
|
||||
memset(&wsi->u, 0, sizeof(wsi->u));
|
||||
|
||||
wsi->mode = LWS_CONNMODE_HTTP_SERVING;
|
||||
wsi->mode = LWS_CONNMODE_HTTP_SERVING_ACCEPTED;
|
||||
wsi->state = WSI_STATE_HTTP;
|
||||
n = 0;
|
||||
if (wsi->protocol->callback)
|
||||
|
|
|
@ -206,7 +206,7 @@ libwebsocket_close_and_free_session(struct libwebsocket_context *context,
|
|||
|
||||
wsi->u.ws.close_reason = reason;
|
||||
|
||||
if (wsi->mode == LWS_CONNMODE_HTTP_SERVING && wsi->u.http.fd) {
|
||||
if (wsi->mode == LWS_CONNMODE_HTTP_SERVING_ACCEPTED && wsi->u.http.fd) {
|
||||
lwsl_debug("closing http fd %d\n", wsi->u.http.fd);
|
||||
close(wsi->u.http.fd);
|
||||
wsi->u.http.fd = 0;
|
||||
|
@ -962,6 +962,7 @@ libwebsocket_service_fd(struct libwebsocket_context *context,
|
|||
|
||||
#ifndef LWS_NO_SERVER
|
||||
case LWS_CONNMODE_HTTP_SERVING:
|
||||
case LWS_CONNMODE_HTTP_SERVING_ACCEPTED:
|
||||
case LWS_CONNMODE_SERVER_LISTENER:
|
||||
case LWS_CONNMODE_SSL_ACK_PENDING:
|
||||
n = lws_server_socket_service(context, wsi, pollfd);
|
||||
|
|
|
@ -211,6 +211,7 @@ enum lws_rx_parse_state {
|
|||
|
||||
enum connection_mode {
|
||||
LWS_CONNMODE_HTTP_SERVING,
|
||||
LWS_CONNMODE_HTTP_SERVING_ACCEPTED, /* actual HTTP service going on */
|
||||
LWS_CONNMODE_PRE_WS_SERVING_ACCEPT,
|
||||
|
||||
LWS_CONNMODE_WS_SERVING,
|
||||
|
|
|
@ -140,6 +140,7 @@ int lws_server_socket_service(struct libwebsocket_context *context,
|
|||
switch (wsi->mode) {
|
||||
|
||||
case LWS_CONNMODE_HTTP_SERVING:
|
||||
case LWS_CONNMODE_HTTP_SERVING_ACCEPTED:
|
||||
|
||||
/* handle http headers coming in */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue