http header malloc pool allow listen accept flow control

Add a private api to enable and disable server listen socket POLLIN

Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
Andy Green 2015-12-25 09:12:08 +08:00
parent ba38a7e6b4
commit b3d21f164d
2 changed files with 24 additions and 0 deletions

View file

@ -536,6 +536,9 @@ struct lws_context {
void *user_space;
struct lws_plat_file_ops fops;
#ifndef LWS_NO_SERVER
struct lws *wsi_listening;
#endif
};
enum {
@ -1220,10 +1223,13 @@ LWS_EXTERN int
_lws_rx_flow_control(struct lws *wsi);
LWS_EXTERN int
lws_handshake_server(struct lws *wsi, unsigned char **buf, size_t len);
LWS_EXTERN int
_lws_server_listen_accept_flow_control(struct lws_context *context, int on);
#else
#define lws_server_socket_service(_a, _b, _c) (0)
#define _lws_rx_flow_control(_a) (0)
#define lws_handshake_server(_a, _b, _c) (0)
#define _lws_server_listen_accept_flow_control(a, b) (0)
#endif
LWS_EXTERN int

View file

@ -124,6 +124,7 @@ int lws_context_init_server(struct lws_context_creation_info *info,
wsi->mode = LWSCM_SERVER_LISTENER;
wsi->protocol = context->protocols;
context->wsi_listening = wsi;
if (insert_wsi_socket_into_fds(context, wsi))
goto bail;
@ -181,6 +182,23 @@ _lws_rx_flow_control(struct lws *wsi)
return 0;
}
int
_lws_server_listen_accept_flow_control(struct lws_context *context, int on)
{
struct lws *wsi = context->wsi_listening;
int n;
if (!wsi)
return 0;
if (on)
n = lws_change_pollfd(wsi, 0, LWS_POLLIN);
else
n = lws_change_pollfd(wsi, LWS_POLLIN, 0);
return n;
}
int lws_http_action(struct lws *wsi)
{
enum http_connection_type connection_type;