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;
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)
while (n >= 0)
n = libwebsocket_service(context, 1000);
- libwebsocket_client_close(wsi_dumb);
- libwebsocket_client_close(wsi_mirror);
-
libwebsocket_context_destroy(context);
return 0;
((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;