From 79fa624c3ec18d945fa09b28c95e5cd183246f2d Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 4 Feb 2016 17:49:45 +0100 Subject: [PATCH] fix: only send data once to the client --- lib/websocket.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/websocket.c b/lib/websocket.c index c84008dbb..403f19d63 100644 --- a/lib/websocket.c +++ b/lib/websocket.c @@ -248,7 +248,7 @@ found: * (void **) user = n; if (w->shutdown) goto shutdown; - if (!w->write.pool) + if (w->write.pool == NULL || w->write.cnt == 0) return 0; /* no samples available to send */ pthread_mutex_lock(&w->write.mutex); @@ -274,6 +274,10 @@ found: * (void **) user = n; memcpy(dst, src, bytes); } + + /* We've done our work here. Do not send again.. */ + w->write.pool = NULL; + w->write.pool = 0; pthread_mutex_unlock(&w->write.mutex);