From: Eduard Bagdasaryan Date: Sat, 18 Apr 2020 10:09:00 +0000 (+0000) Subject: Preserve half-closed transaction context (#605) X-Git-Tag: 4.15-20210522-snapshot~137 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1f9077c226385ee5d410c2e83d3dc075e0586358;p=thirdparty%2Fsquid.git Preserve half-closed transaction context (#605) The code monitoring half-closed connections (with half_closed_clients "on") did not save and did not restore transaction contexts. --- diff --git a/src/comm.cc b/src/comm.cc index 72a1cb1311..6b85af6291 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1639,6 +1639,7 @@ commStartHalfClosedMonitor(int fd) debugs(5, 5, HERE << "adding FD " << fd << " to " << *TheHalfClosed); assert(isOpen(fd) && !commHasHalfClosedMonitor(fd)); (void)TheHalfClosed->add(fd); // could also assert the result + fd_table[fd].codeContext = CodeContext::Current(); commPlanHalfClosedCheck(); // may schedule check if we added the first FD } @@ -1666,10 +1667,12 @@ commHalfClosedCheck(void *) Comm::ConnectionPointer c = new Comm::Connection; // XXX: temporary. make HalfClosed a list of these. c->fd = *i; if (!fd_table[c->fd].halfClosedReader) { // not reading already - AsyncCall::Pointer call = commCbCall(5,4, "commHalfClosedReader", - CommIoCbPtrFun(&commHalfClosedReader, NULL)); - Comm::Read(c, call); - fd_table[c->fd].halfClosedReader = call; + CallBack(fd_table[c->fd].codeContext, [&c] { + AsyncCall::Pointer call = commCbCall(5,4, "commHalfClosedReader", + CommIoCbPtrFun(&commHalfClosedReader, nullptr)); + Comm::Read(c, call); + fd_table[c->fd].halfClosedReader = call; + }); } else c->fd = -1; // XXX: temporary. prevent c replacement erase closing listed FD }