]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream_interface: add reporting of ressouce allocation errors
authorWilly Tarreau <w@1wt.eu>
Mon, 14 May 2012 10:11:47 +0000 (12:11 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 9 Dec 2013 16:12:18 +0000 (17:12 +0100)
SSL and keep-alive will need to be able to fail on allocation errors,
and the stream interface did not allow to report such a cause. The flag
will then be "RC" as already documented.

include/types/stream_interface.h
src/proto_http.c
src/session.c

index afe1ec86d420317a4f8f77562ed4a4221941cb5c..f0b63c485c0e48e6fd08d9048bd99cd7e01731fd 100644 (file)
@@ -57,10 +57,11 @@ enum {
        SI_ET_CONN_TO    = 0x0008,  /* connection timeout */
        SI_ET_CONN_ERR   = 0x0010,  /* connection error (eg: no server available) */
        SI_ET_CONN_ABRT  = 0x0020,  /* connection aborted by external cause (eg: abort) */
-       SI_ET_CONN_OTHER = 0x0040,  /* connection aborted for other reason (eg: 500) */
-       SI_ET_DATA_TO    = 0x0080,  /* timeout during data phase */
-       SI_ET_DATA_ERR   = 0x0100,  /* error during data phase */
-       SI_ET_DATA_ABRT  = 0x0200,  /* data phase aborted by external cause */
+       SI_ET_CONN_RES   = 0x0040,  /* connection aborted due to lack of resources */
+       SI_ET_CONN_OTHER = 0x0080,  /* connection aborted for other reason (eg: 500) */
+       SI_ET_DATA_TO    = 0x0100,  /* timeout during data phase */
+       SI_ET_DATA_ERR   = 0x0200,  /* error during data phase */
+       SI_ET_DATA_ABRT  = 0x0400,  /* data phase aborted by external cause */
 };
 
 /* flags set after I/O (16 bit) */
index a7e42fc5d094533f77228a1b339eab752a633ba4..900f747ee3f7016c78487a481a4dfeb0f3955ecb 100644 (file)
@@ -936,6 +936,9 @@ void http_return_srv_error(struct session *s, struct stream_interface *si)
        else if (err_type & SI_ET_CONN_ERR)
                http_server_error(s, si, SN_ERR_SRVCL, SN_FINST_C,
                                  503, http_error_message(s, HTTP_ERR_503));
+       else if (err_type & SI_ET_CONN_RES)
+               http_server_error(s, si, SN_ERR_RESOURCE, SN_FINST_C,
+                                 503, http_error_message(s, HTTP_ERR_503));
        else /* SI_ET_CONN_OTHER and others */
                http_server_error(s, si, SN_ERR_INTERNAL, SN_FINST_C,
                                  500, http_error_message(s, HTTP_ERR_500));
index 1183d91e308a746579c74841bf11953fe5e6d3e7..75ac04c77db9c35a9f9d29aadf8792af0cff9676 100644 (file)
@@ -2576,6 +2576,10 @@ void default_srv_error(struct session *s, struct stream_interface *si)
                err = SN_ERR_SRVCL;
                fin = SN_FINST_C;
        }
+       else if (err_type & SI_ET_CONN_RES) {
+               err = SN_ERR_RESOURCE;
+               fin = SN_FINST_C;
+       }
        else /* SI_ET_CONN_OTHER and others */ {
                err = SN_ERR_INTERNAL;
                fin = SN_FINST_C;