aboutsummaryrefslogtreecommitdiff
path: root/client/acronc/handler_socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/acronc/handler_socket.c')
-rw-r--r--client/acronc/handler_socket.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/client/acronc/handler_socket.c b/client/acronc/handler_socket.c
index efed127..2dfda5e 100644
--- a/client/acronc/handler_socket.c
+++ b/client/acronc/handler_socket.c
@@ -156,6 +156,26 @@ static void on_read(uv_stream_t *tcp, ssize_t nread, const uv_buf_t *buf) {
/* acronc error. Socket is working. */
ex(false);
}
+
+ LOGD("Clearing backlog.");
+ while (true) {
+ if ((r = ac_receive(ac_conn, NULL, 0, &obj))) {
+ LOGEV("Cannot clear backlog (%d).", r);
+ /* libac error. Socket is working. */
+ free(buf->base);
+ ex(false);
+ return;
+ }
+ if (!obj) {
+ break;
+ }
+ if (cb_recv(obj)) {
+ /* acronc error. Socket is working. */
+ ex(false);
+ free(buf->base);
+ return;
+ }
+ }
}
free(buf->base);