]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: h2: new function h2s_error() to mark an error on a stream
authorWilly Tarreau <w@1wt.eu>
Tue, 17 Oct 2017 06:03:59 +0000 (08:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 17:12:14 +0000 (18:12 +0100)
This one will store the error into the stream's errcode if it's neither
idle nor closed (since these ones are read-only) and switch its state to
H2_SS_ERROR. If a conn_stream is attached, it will be flagged with
CS_FL_ERROR.

src/mux_h2.c

index ff9df381cf58619fa2bc56eb9b9736b8b3344f21..6268465d8f7300022ecb137a669f49ed1cf12101 100644 (file)
@@ -380,6 +380,17 @@ static inline void h2c_error(struct h2c *h2c, enum h2_err err)
        h2c->st0 = H2_CS_ERROR;
 }
 
+/* marks an error on the stream */
+static inline void h2s_error(struct h2s *h2s, enum h2_err err)
+{
+       if (h2s->st > H2_SS_IDLE && h2s->st < H2_SS_ERROR) {
+               h2s->errcode = err;
+               h2s->st = H2_SS_ERROR;
+               if (h2s->cs)
+                       h2s->cs->flags |= CS_FL_ERROR;
+       }
+}
+
 
 /*********************************************************/
 /* functions below are I/O callbacks from the connection */