restore accept error as closure signal
Signed-off-by: Andy Green <andy.green@linaro.org>
diff --git a/test-server/test-client.c b/test-server/test-client.c
index 9d1d9ef..ffd6365 100644
--- a/test-server/test-client.c
+++ b/test-server/test-client.c
@@ -287,6 +287,9 @@
while (n >= 0 && !was_closed) {
n = libwebsocket_service(context, 1000);
+ if (n < 0)
+ continue;
+
if (wsi_mirror == NULL) {
/* create a client websocket using mirror protocol */
diff --git a/test-server/test-server-extpoll.c b/test-server/test-server-extpoll.c
index 0b44d8a..8131412 100644
--- a/test-server/test-server-extpoll.c
+++ b/test-server/test-server-extpoll.c
@@ -517,8 +517,9 @@
* match anything under libwebsockets
* control
*/
- libwebsocket_service_fd(context,
- &pollfds[n]);
+ if (libwebsocket_service_fd(context,
+ &pollfds[n]))
+ goto done;
/* do our broadcast periodically */
diff --git a/test-server/test-server.c b/test-server/test-server.c
index dae0a8d..516deff 100644
--- a/test-server/test-server.c
+++ b/test-server/test-server.c
@@ -463,7 +463,8 @@
fprintf(stderr, " Using no-fork service loop\n");
- while (1) {
+ n = 0;
+ while (n >= 0) {
struct timeval tv;
gettimeofday(&tv, NULL);
@@ -495,10 +496,11 @@
* "manually".
*
* If no socket is needing service, the call below returns
- * immediately and quickly.
+ * immediately and quickly. Negative return means we are
+ * in process of closing
*/
- libwebsocket_service(context, 50);
+ n = libwebsocket_service(context, 50);
}
#else