]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: connection: add more error codes to report connection errors
authorWilly Tarreau <w@1wt.eu>
Fri, 24 Jan 2014 15:06:50 +0000 (16:06 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 24 Jan 2014 15:15:04 +0000 (16:15 +0100)
It is quite often that an connection error only reports "socket error" with
no more information. This is especially problematic with health checks where
many causes are possible, including resource exhaustion which do not lead to
a valid errno code. So let's add explicit codes to cover these cases.

include/proto/connection.h
include/types/connection.h

index 7c969eb4cb4c56b3832d56a1773f3225b51ff203..af995cd1566695e240b9c60b6d39a23543c669e1 100644 (file)
@@ -601,6 +601,18 @@ static inline const char *conn_err_code_str(struct connection *c)
 {
        switch (c->err_code) {
        case CO_ER_NONE:          return "Success";
+
+       case CO_ER_CONF_FDLIM:    return "Reached configured maxconn value";
+       case CO_ER_PROC_FDLIM:    return "Too many sockets on the process";
+       case CO_ER_SYS_FDLIM:     return "Too many sockets on the system";
+       case CO_ER_SYS_MEMLIM:    return "Out of system buffers";
+       case CO_ER_NOPROTO:       return "Protocol or address family not supported";
+       case CO_ER_SOCK_ERR:      return "General socket error";
+       case CO_ER_PORT_RANGE:    return "Source port range exhausted";
+       case CO_ER_CANT_BIND:     return "Can't bind to source address";
+       case CO_ER_FREE_PORTS:    return "Out of local source ports on the system";
+       case CO_ER_ADDR_INUSE:    return "Local source address already in use";
+
        case CO_ER_PRX_EMPTY:     return "Connection closed while waiting for PROXY protocol header";
        case CO_ER_PRX_ABORT:     return "Connection error while waiting for PROXY protocol header";
        case CO_ER_PRX_TIMEOUT:   return "Timeout while waiting for PROXY protocol header";
index eb99cc9ac1c61974c52889106d779d1b6b72bd9e..cf93999e040b975689e09fa551f5b13b889e70c4 100644 (file)
@@ -149,6 +149,19 @@ enum {
 /* possible connection error codes */
 enum {
        CO_ER_NONE,             /* no error */
+
+       CO_ER_CONF_FDLIM,       /* reached process' configured FD limitation */
+       CO_ER_PROC_FDLIM,       /* reached process' FD limitation */
+       CO_ER_SYS_FDLIM,        /* reached system's FD limitation */
+       CO_ER_SYS_MEMLIM,       /* reached system buffers limitation */
+       CO_ER_NOPROTO,          /* protocol not supported */
+       CO_ER_SOCK_ERR,         /* other socket error */
+
+       CO_ER_PORT_RANGE,       /* source port range exhausted */
+       CO_ER_CANT_BIND,        /* can't bind to source address */
+       CO_ER_FREE_PORTS,       /* no more free ports on the system */
+       CO_ER_ADDR_INUSE,       /* local address already in use */
+
        CO_ER_PRX_EMPTY,        /* nothing received in PROXY protocol header */
        CO_ER_PRX_ABORT,        /* client abort during PROXY protocol header */
        CO_ER_PRX_TIMEOUT,      /* timeout while waiting for a PROXY header */