|
36 | 36 | #include <stdio.h> |
37 | 37 |
|
38 | 38 | #include "cache/cache_transport.h" |
| 39 | +#include "cache/cache_objhead.h" |
39 | 40 | #include "http2/cache_http2.h" |
40 | 41 |
|
41 | 42 | #include "vend.h" |
@@ -444,17 +445,59 @@ h2_new_session(struct worker *wrk, void *arg) |
444 | 445 | static void |
445 | 446 | h2_waitlist(struct worker *wrk, struct req *req) |
446 | 447 | { |
| 448 | + struct objhead *oh; |
| 449 | + struct h2_req *r2; |
447 | 450 |
|
448 | 451 | CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); |
449 | 452 | CHECK_OBJ_NOTNULL(req, REQ_MAGIC); |
| 453 | + oh = req->hash_objhead; |
| 454 | + CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); |
| 455 | + CAST_OBJ_NOTNULL(r2, req->top->topreq->transport_priv, H2_REQ_MAGIC); |
| 456 | + |
| 457 | + if (DO_DEBUG(DBG_WAITINGLIST)) |
| 458 | + VSLb(req->vsl, SLT_Debug, "on h2 waiting list <%p>", r2); |
| 459 | + |
| 460 | + Lck_AssertHeld(&oh->mtx); |
| 461 | + AN(req->waitinglist); |
| 462 | + AZ(req->wrk); |
| 463 | + |
| 464 | + assert(oh->refcnt > 0); |
| 465 | + oh->refcnt++; |
| 466 | + |
| 467 | + Lck_Lock(&r2->h2sess->sess->mtx); |
| 468 | + AZ(req->transport_objhead); |
| 469 | + req->transport_objhead = oh; |
| 470 | + VTAILQ_INSERT_TAIL(&r2->waitinglist, req, t_list); |
| 471 | + Lck_Unlock(&r2->h2sess->sess->mtx); |
450 | 472 | } |
451 | 473 |
|
452 | 474 | static void |
453 | 475 | h2_reembark(struct worker *wrk, struct req *req) |
454 | 476 | { |
| 477 | + struct objhead *oh; |
| 478 | + struct h2_req *r2; |
455 | 479 |
|
456 | 480 | CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); |
457 | 481 | CHECK_OBJ_NOTNULL(req, REQ_MAGIC); |
| 482 | + CAST_OBJ_NOTNULL(r2, req->top->topreq->transport_priv, H2_REQ_MAGIC); |
| 483 | + |
| 484 | + if (DO_DEBUG(DBG_WAITINGLIST)) |
| 485 | + VSLb(req->vsl, SLT_Debug, "off h2 waiting list <%p>", r2); |
| 486 | + |
| 487 | + Lck_Lock(&r2->h2sess->sess->mtx); |
| 488 | + VTAILQ_REMOVE(&r2->waitinglist, req, t_list); |
| 489 | + oh = req->transport_objhead; |
| 490 | + req->transport_objhead = NULL; |
| 491 | + Lck_Unlock(&r2->h2sess->sess->mtx); |
| 492 | + |
| 493 | + CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); |
| 494 | + Lck_Lock(&oh->mtx); |
| 495 | + AN(req->hash_objhead); |
| 496 | + AZ(req->waitinglist); |
| 497 | + AZ(req->wrk); |
| 498 | + assert(oh->refcnt > 1); |
| 499 | + oh->refcnt--; |
| 500 | + Lck_Unlock(&oh->mtx); |
458 | 501 |
|
459 | 502 | if (IS_TOPREQ(req)) |
460 | 503 | AZ(Pool_Task(req->sp->pool, req->task, TASK_QUEUE_RUSH)); |
|
0 commit comments