1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

esp32: compiler complains about insert_wsi as macro

This commit is contained in:
Jackson Ming Hu 2019-07-01 14:51:21 +01:00 committed by Andy Green
parent 6b348a54bd
commit 4064daddf8
2 changed files with 19 additions and 4 deletions

View file

@ -44,3 +44,15 @@ lws_plat_change_pollfd(struct lws_context *context,
{
return 0;
}
int
insert_wsi(const struct lws_context *context, struct lws *wsi)
{
assert(context->lws_lookup[wsi->desc.sockfd -
lws_plat_socket_offset()] == 0);
context->lws_lookup[wsi->desc.sockfd - \
lws_plat_socket_offset()] = wsi;
return 0;
}

View file

@ -90,9 +90,12 @@ gai_strerror(int);
#define compatible_close(x) close(x)
#define lws_plat_socket_offset() LWIP_SOCKET_OFFSET
#define wsi_from_fd(A,B) A->lws_lookup[B - lws_plat_socket_offset()]
#define insert_wsi(A,B) assert(A->lws_lookup[B->desc.sockfd - \
lws_plat_socket_offset()] == 0); \
A->lws_lookup[B->desc.sockfd - \
lws_plat_socket_offset()] = B
struct lws_context;
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