mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
delete_from_fd: assert if fd beyond the max_fds
Signed-off-by: songbuhuang <544824346@qq.com>
This commit is contained in:
parent
2c981f7670
commit
237506fed1
4 changed files with 9 additions and 4 deletions
|
@ -119,7 +119,8 @@ struct lws;
|
|||
int
|
||||
insert_wsi(const struct lws_context *context, struct lws *wsi);
|
||||
|
||||
#define delete_from_fd(A,B) A->lws_lookup[B - lws_plat_socket_offset()] = 0
|
||||
#define delete_from_fd(A,B) assert((int)A->max_fds > B - lws_plat_socket_offset()); \
|
||||
A->lws_lookup[B - lws_plat_socket_offset()] = 0
|
||||
|
||||
#define LWS_PLAT_TIMER_TYPE TimerHandle_t
|
||||
#define LWS_PLAT_TIMER_CB(name, var) void name(TimerHandle_t var)
|
||||
|
|
|
@ -46,5 +46,6 @@
|
|||
lws_plat_socket_offset()] == 0); \
|
||||
A->lws_lookup[B->desc.sockfd - \
|
||||
lws_plat_socket_offset()] = B
|
||||
#define delete_from_fd(A,B) A->lws_lookup[B - lws_plat_socket_offset()] = 0
|
||||
#define delete_from_fd(A,B) assert((int)A->max_fds > B - lws_plat_socket_offset()); \
|
||||
A->lws_lookup[B - lws_plat_socket_offset()] = 0
|
||||
|
||||
|
|
|
@ -174,8 +174,10 @@ delete_from_fd(const struct lws_context *context, int fd)
|
|||
struct lws **p, **done;
|
||||
|
||||
if (!context->max_fds_unrelated_to_ulimit) {
|
||||
if (context->lws_lookup)
|
||||
if (context->lws_lookup) {
|
||||
assert((int)context->max_fds > fd - lws_plat_socket_offset());
|
||||
context->lws_lookup[fd - lws_plat_socket_offset()] = NULL;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -116,7 +116,8 @@ struct lws;
|
|||
int
|
||||
insert_wsi(const struct lws_context *context, struct lws *wsi);
|
||||
|
||||
#define delete_from_fd(A,B) A->lws_lookup[B - lws_plat_socket_offset()] = 0
|
||||
#define delete_from_fd(A,B) assert((int)A->max_fds > B - lws_plat_socket_offset()); \
|
||||
A->lws_lookup[B - lws_plat_socket_offset()] = 0
|
||||
|
||||
#define LWS_PLAT_TIMER_TYPE TimerHandle_t
|
||||
#define LWS_PLAT_TIMER_CB(name, var) void name(TimerHandle_t var)
|
||||
|
|
Loading…
Add table
Reference in a new issue