Skip to content

Commit

Permalink
http2: New H2_ERROR_MATCH() helper macro
Browse files Browse the repository at this point in the history
  • Loading branch information
Dridi committed Mar 29, 2024
1 parent a90f542 commit 803140a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions bin/varnishd/http2/cache_http2.h
Expand Up @@ -50,6 +50,9 @@ struct h2_error_s {

typedef const struct h2_error_s *h2_error;

#define H2_ERROR_MATCH(err, target) \
((err) != NULL && (err)->val == (target)->val)

#define H2_CUSTOM_ERRORS
#define H2EC1(U,v,g,r,d) extern const struct h2_error_s H2CE_##U[1];
#define H2EC2(U,v,g,r,d) extern const struct h2_error_s H2SE_##U[1];
Expand Down
2 changes: 1 addition & 1 deletion bin/varnishd/http2/cache_http2_send.c
Expand Up @@ -435,6 +435,6 @@ H2_Send(struct worker *wrk, struct h2_req *r2, h2_frame ftyp, uint8_t flags,
h2_send(wrk, r2, ftyp, flags, len, ptr, counter);

h2e = h2_errcheck(r2, r2->h2sess);
if (h2e != NULL && h2e->val == H2SE_CANCEL->val)
if (H2_ERROR_MATCH(h2e, H2SE_CANCEL))
H2_Send_RST(wrk, r2->h2sess, r2, r2->stream, h2e);
}

0 comments on commit 803140a

Please sign in to comment.