]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CONTRIB: tcploop: add a shutr command
authorWilly Tarreau <w@1wt.eu>
Thu, 5 Oct 2017 04:31:10 +0000 (06:31 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 2 Apr 2021 15:48:42 +0000 (17:48 +0200)
Usually this has limited effect except for listening sockets, but
at least it helps compare behaviors with and without.

contrib/tcploop/tcploop.c

index 0571a6dfd7048d93f396b6c78aab93b16b26acc4..c7cec6f68c0e5317aee96234c11e2e44d6958406 100644 (file)
@@ -118,6 +118,7 @@ __attribute__((noreturn)) void usage(int code, const char *arg0)
            "  I            : wait for Input data to be present (POLLIN)\n"
            "  O            : wait for Output queue to be empty (POLLOUT + TIOCOUTQ)\n"
            "  F            : FIN : shutdown(SHUT_WR)\n"
+           "  r            : shutr : shutdown(SHUT_RD) (pauses a listener or ends recv)\n"
            "  N<max>       : fork New process, limited to <max> concurrent (default 1)\n"
            "  X[i|o|e]* ** : execvp() next args passing socket as stdin/stdout/stderr.\n"
            "                 If i/o/e present, only stdin/out/err are mapped to socket.\n"
@@ -897,7 +898,14 @@ int main(int argc, char **argv)
                        /* ignore errors on shutdown() as they are common */
                        if (sock >= 0)
                                shutdown(sock, SHUT_WR);
-                       dolog("shutdown\n");
+                       dolog("shutdown(w)\n");
+                       break;
+
+               case 'r':
+                       /* ignore errors on shutdown() as they are common */
+                       if (sock >= 0)
+                               shutdown(sock, SHUT_RD);
+                       dolog("shutdown(r)\n");
                        break;
 
                case 'N':