zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mic...@apache.org
Subject svn commit: r1380931 - in /zookeeper/trunk: CHANGES.txt src/c/src/zookeeper.c
Date Tue, 04 Sep 2012 23:18:44 GMT
Author: michim
Date: Tue Sep  4 23:18:44 2012
New Revision: 1380931

URL: http://svn.apache.org/viewvc?rev=1380931&view=rev
Log:
ZOOKEEPER-1105 c client zookeeper_close not send CLOSE_OP request to server (lincoln.lee via
michim)

Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/src/c/src/zookeeper.c

Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1380931&r1=1380930&r2=1380931&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Tue Sep  4 23:18:44 2012
@@ -234,6 +234,9 @@ BUGFIXES:
   ZOOKEEPER-1328. Misplaced assertion for the test case 'FLELostMessageTest'
   and not identifying misfunctions. (Rakesh R via mahadev)
 
+  ZOOKEEPER-1105 c client zookeeper_close not send CLOSE_OP request to server
+  (lincoln.lee via michim)
+
 IMPROVEMENTS:
 
   ZOOKEEPER-1170. Fix compiler (eclipse) warnings: unused imports,

Modified: zookeeper/trunk/src/c/src/zookeeper.c
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/zookeeper.c?rev=1380931&r1=1380930&r2=1380931&view=diff
==============================================================================
--- zookeeper/trunk/src/c/src/zookeeper.c (original)
+++ zookeeper/trunk/src/c/src/zookeeper.c Tue Sep  4 23:18:44 2012
@@ -2519,6 +2519,22 @@ int zookeeper_close(zhandle_t *zh)
         /* make sure the close request is sent; we set timeout to an arbitrary
          * (but reasonable) number of milliseconds since we want the call to block*/
         rc=adaptor_send_queue(zh, 3000);
+
+        /* make sure server has read the close request and sent back a response*/ 
+        struct pollfd fd_s[1];
+        fd_s[0].fd = zh->fd;
+        fd_s[0].events = POLLIN;
+        int ret = poll(fd_s, 1, 1000);
+        if (ret == 0) {
+            LOG_WARN(("Timeout when waitting for server's reply after sending a close request,
sessionId=%#llx\n",
+                zh->client_id.client_id));
+        } else if (ret < 0) {
+            LOG_WARN(("System error happens when waitting for server's reply, sessionId=%#llx\n",
+                zh->client_id.client_id));
+        } else {
+            // do nothing
+        }
+
     }else{
         LOG_INFO(("Freeing zookeeper resources for sessionId=%#llx\n",
                 zh->client_id.client_id));



Mime
View raw message