CLEANUP: mux-h2: make use of cs_set_error()
It's cleaner than open-coding the conditions and error bits.
diff --git a/src/mux_h2.c b/src/mux_h2.c
index aef6d38..4ca7122 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -589,13 +589,8 @@
if (h2s->id && h2s->st < H2_SS_ERROR) {
h2s->errcode = err;
h2s->st = H2_SS_ERROR;
- if (h2s->cs) {
- if (h2s->cs->flags & CS_FL_EOS)
- h2s->cs->flags |= CS_FL_ERROR;
- else {
- h2s->cs->flags |= CS_FL_REOS | CS_FL_ERR_PENDING;
- }
- }
+ if (h2s->cs)
+ cs_set_error(h2s->cs);
}
}
@@ -1786,11 +1781,7 @@
h2s_close(h2s);
if (h2s->cs) {
- if (h2s->cs->flags & CS_FL_EOS)
- h2s->cs->flags |= CS_FL_ERROR;
- else
- h2s->cs->flags |= CS_FL_REOS | CS_FL_ERR_PENDING;
-
+ cs_set_error(h2s->cs);
h2s_alert(h2s);
}
@@ -4820,11 +4811,7 @@
break;
}
else {
- if (cs->flags & CS_FL_EOS)
- cs->flags |= CS_FL_ERROR;
- else
- cs->flags |= CS_FL_REOS | CS_FL_ERR_PENDING;
-
+ cs_set_error(cs);
break;
}
@@ -4849,11 +4836,7 @@
/* RST are sent similarly to frame acks */
if (h2s->st == H2_SS_ERROR || h2s->flags & H2_SF_RST_RCVD) {
- if (cs->flags & CS_FL_EOS)
- cs->flags |= CS_FL_ERROR;
- else
- cs->flags |= CS_FL_REOS | CS_FL_ERR_PENDING;
-
+ cs_set_error(cs);
if (h2s_send_rst_stream(h2s->h2c, h2s) > 0)
h2s_close(h2s);
}