Add client_{lock,unlock} before call to non_block_events
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 28 Jan 2014 14:44:07 +0000 (15:44 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 28 Jan 2014 14:44:07 +0000 (15:44 +0100)
in connection_continue. Problem is that if non_block_events
fire records, then we will not unlock client at all. And as
a result a dead-lock occurs.

src/connection.c

index 5f127ea..41e693c 100644 (file)
@@ -284,7 +284,13 @@ void connection_continue(struct connection *co)
 {
     int r = ZOOM_connection_exec_task(co->link);
     if (!r)
+    {
+        struct client *cl = co->client;
+
+        client_lock(cl);
         non_block_events(co);
+        client_unlock(cl);
+    }
     else
     {
         iochan_setflags(co->iochan, ZOOM_connection_get_mask(co->link));