[LIBQB][PATCH] -ENOTCONN handled as error when client disconnects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When libqb-0.14.2 (master) is used with pacemaker 1.1.8 (master) the following 2 lines are logged:
Sep 21 23:17:27 [19442]        cib:    error: _process_request_:        recv from client connection failed (19442-19447-12): Error 0 (0)
Sep 21 23:17:27 [19442]        cib:    error: qb_ipcs_dispatch_connection_request:      request returned error (19442-19447-12): Transport endpoint is not connected (134)

In Solaris/OpenIndiana qb_ipc_us_recv_at_most returns -ENOTCONN when a client disconnects.
_process_request_ and qb_ipcs_dispatch_connection_request don't know this and log the 2 errors.
With this patch the logging is suppressed.


diff --git a/lib/ipcs.c b/lib/ipcs.c
index 0fa7142..ac9c9fa 100644
--- a/lib/ipcs.c
+++ b/lib/ipcs.c
@@ -627,7 +627,8 @@ _process_request_(struct qb_ipcs_connection *c, int32_t ms_timeout)
                                              ms_timeout);
        }
        if (size < 0) {
-               if (size != -EAGAIN && size != -ETIMEDOUT) {
+                if (size == -ENOTCONN) {
+               } else if (size != -EAGAIN && size != -ETIMEDOUT) {
                        qb_util_perror(LOG_ERR,
                                       "recv from client connection failed (%s)",
                                       c->description);
@@ -774,13 +775,16 @@ qb_ipcs_dispatch_connection_request(int32_t fd, int32_t revents, void *data)
        res = QB_MIN(0, res);
        if (res == -EAGAIN || res == -ETIMEDOUT || res == -ENOBUFS) {
                res = 0;
-       }
-       if (res != 0) {
+        } else if (res == -ENOTCONN) {
+             errno = -res;
+             qb_ipcs_disconnect(c);
+             res = -ESHUTDOWN;
+        } else if (res != 0) {
                errno = -res;
                qb_util_perror(LOG_ERR, "request returned error (%s)",
                               c->description);
                qb_ipcs_connection_unref(c);
-       }
+       }

        return res;
 }

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux