mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
fix-context-close.patch
Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
parent
2f4c2be52a
commit
6a98054a36
4 changed files with 8 additions and 11 deletions
|
@ -21,6 +21,9 @@ libwebsocket_client_close(struct libwebsocket *wsi)
|
|||
int n = wsi->state;
|
||||
struct libwebsocket_context *clients;
|
||||
|
||||
if (n == WSI_STATE_DEAD_SOCKET)
|
||||
return;
|
||||
|
||||
/* mark the WSI as dead and let the callback know */
|
||||
|
||||
wsi->state = WSI_STATE_DEAD_SOCKET;
|
||||
|
|
|
@ -222,8 +222,11 @@ libwebsocket_context_destroy(struct libwebsocket_context *this)
|
|||
int client;
|
||||
|
||||
/* close listening skt and per-protocol broadcast sockets */
|
||||
for (client = 0; client < this->fds_count; client++)
|
||||
libwebsocket_close_and_free_session(this->wsi[client]);
|
||||
for (client = this->count_protocols + 1; client < this->fds_count; client++)
|
||||
if (this->wsi[client]->client_mode)
|
||||
libwebsocket_client_close(this->wsi[client]);
|
||||
else
|
||||
libwebsocket_close_and_free_session(this->wsi[client]);
|
||||
|
||||
#ifdef LWS_OPENSSL_SUPPORT
|
||||
if (this->ssl_ctx)
|
||||
|
|
|
@ -243,9 +243,6 @@ int main(int argc, char **argv)
|
|||
while (n >= 0)
|
||||
n = libwebsocket_service(context, 1000);
|
||||
|
||||
libwebsocket_client_close(wsi_dumb);
|
||||
libwebsocket_client_close(wsi_mirror);
|
||||
|
||||
libwebsocket_context_destroy(context);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -489,12 +489,6 @@ int main(int argc, char **argv)
|
|||
((double)global_rx_count * (double)size) /
|
||||
((double)(l - started) / 1000000.0) / 1024.0);
|
||||
|
||||
// return 0;
|
||||
fprintf(stderr, "a\n");
|
||||
for (n = 0; n < clients; n++)
|
||||
libwebsocket_client_close(wsi[n]);
|
||||
|
||||
fprintf(stderr, "b\n");
|
||||
libwebsocket_context_destroy(context);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue