mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
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:
parent
ba38a7e6b4
commit
b3d21f164d
2 changed files with 24 additions and 0 deletions
|
@ -536,6 +536,9 @@ struct lws_context {
|
||||||
void *user_space;
|
void *user_space;
|
||||||
|
|
||||||
struct lws_plat_file_ops fops;
|
struct lws_plat_file_ops fops;
|
||||||
|
#ifndef LWS_NO_SERVER
|
||||||
|
struct lws *wsi_listening;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -1220,10 +1223,13 @@ LWS_EXTERN int
|
||||||
_lws_rx_flow_control(struct lws *wsi);
|
_lws_rx_flow_control(struct lws *wsi);
|
||||||
LWS_EXTERN int
|
LWS_EXTERN int
|
||||||
lws_handshake_server(struct lws *wsi, unsigned char **buf, size_t len);
|
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
|
#else
|
||||||
#define lws_server_socket_service(_a, _b, _c) (0)
|
#define lws_server_socket_service(_a, _b, _c) (0)
|
||||||
#define _lws_rx_flow_control(_a) (0)
|
#define _lws_rx_flow_control(_a) (0)
|
||||||
#define lws_handshake_server(_a, _b, _c) (0)
|
#define lws_handshake_server(_a, _b, _c) (0)
|
||||||
|
#define _lws_server_listen_accept_flow_control(a, b) (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LWS_EXTERN int
|
LWS_EXTERN int
|
||||||
|
|
18
lib/server.c
18
lib/server.c
|
@ -124,6 +124,7 @@ int lws_context_init_server(struct lws_context_creation_info *info,
|
||||||
wsi->mode = LWSCM_SERVER_LISTENER;
|
wsi->mode = LWSCM_SERVER_LISTENER;
|
||||||
wsi->protocol = context->protocols;
|
wsi->protocol = context->protocols;
|
||||||
|
|
||||||
|
context->wsi_listening = wsi;
|
||||||
if (insert_wsi_socket_into_fds(context, wsi))
|
if (insert_wsi_socket_into_fds(context, wsi))
|
||||||
goto bail;
|
goto bail;
|
||||||
|
|
||||||
|
@ -181,6 +182,23 @@ _lws_rx_flow_control(struct lws *wsi)
|
||||||
return 0;
|
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)
|
int lws_http_action(struct lws *wsi)
|
||||||
{
|
{
|
||||||
enum http_connection_type connection_type;
|
enum http_connection_type connection_type;
|
||||||
|
|
Loading…
Add table
Reference in a new issue