static void
clientHttpConnectionsOpen(void)
{
+ const auto savedContext = CodeContext::Current();
for (AnyP::PortCfgPointer s = HttpPortList; s != nullptr; s = s->next) {
+ CodeContext::Reset(s);
const SBuf &scheme = AnyP::UriScheme(s->transport.protocol).image();
if (MAXTCPLISTENPORTS == NHttpSockets) {
CommAcceptCbPtrFun(isHttps ? httpsAccept : httpAccept, CommAcceptCbParams(nullptr)));
clientStartListeningOn(s, subCall, isHttps ? Ipc::fdnHttpsSocket : Ipc::fdnHttpSocket);
}
+ CodeContext::Reset(savedContext);
}
void
void
clientConnectionsClose()
{
+ const auto savedContext = CodeContext::Current();
for (AnyP::PortCfgPointer s = HttpPortList; s != nullptr; s = s->next) {
+ CodeContext::Reset(s);
if (s->listenConn != nullptr) {
debugs(1, Important(14), "Closing HTTP(S) port " << s->listenConn->local);
s->listenConn->close();
s->listenConn = nullptr;
}
}
+ CodeContext::Reset(savedContext);
Ftp::StopListening();
#include "squid.h"
#include "acl/FilledChecklist.h"
#include "anyp/PortCfg.h"
+#include "base/CodeContext.h"
#include "base/TextException.h"
#include "client_db.h"
#include "comm/AcceptLimiter.h"
void
Comm::TcpAcceptor::start()
{
- if (listenPort_)
- CodeContext::Reset(listenPort_);
debugs(5, 5, status() << " AsyncCall Subscription: " << theCallSub);
Must(IsConnOpen(conn));
Comm::TcpAcceptor::logAcceptError(const ConnectionPointer &tcpClient) const
{
AccessLogEntry::Pointer al = new AccessLogEntry;
- CodeContext::Reset(al);
- al->tcpClient = tcpClient;
- al->url = "error:accept-client-connection";
- al->setVirginUrlForMissingRequest(al->url);
- ACLFilledChecklist ch(nullptr, nullptr, nullptr);
- ch.src_addr = tcpClient->remote;
- ch.my_addr = tcpClient->local;
- ch.al = al;
- accessLogLog(al, &ch);
-
- CodeContext::Reset(listenPort_);
+ CallBack(al, [&] {
+ al->tcpClient = tcpClient;
+ al->url = "error:accept-client-connection";
+ al->setVirginUrlForMissingRequest(al->url);
+ ACLFilledChecklist ch(nullptr, nullptr, nullptr);
+ ch.src_addr = tcpClient->remote;
+ ch.my_addr = tcpClient->local;
+ ch.al = al;
+ accessLogLog(al, &ch);
+ });
}
void
debugs(5, 5, "try later: " << conn << " handler Subscription: " << theCallSub);
} else {
// TODO: When ALE, MasterXaction merge, use them or ClientConn instead.
- CodeContext::Reset(newConnDetails);
- debugs(5, 5, "Listener: " << conn <<
- " accepted new connection " << newConnDetails <<
- " handler Subscription: " << theCallSub);
- notify(flag, newConnDetails);
- CodeContext::Reset(listenPort_);
+ CallBack(newConnDetails, [&] {
+ debugs(5, 5, "Listener: " << conn <<
+ " accepted new connection " << newConnDetails <<
+ " handler Subscription: " << theCallSub);
+ notify(flag, newConnDetails);
+ });
}
SetSelect(conn->fd, COMM_SELECT_READ, doAccept, this, 0);
void
Ftp::StartListening()
{
+ const auto savedContext = CodeContext::Current();
for (AnyP::PortCfgPointer s = FtpPortList; s != nullptr; s = s->next) {
+ CodeContext::Reset(s);
if (MAXTCPLISTENPORTS == NHttpSockets) {
debugs(1, DBG_IMPORTANT, "Ignoring ftp_port lines exceeding the" <<
" limit of " << MAXTCPLISTENPORTS << " ports.");
CommAcceptCbParams(nullptr)));
clientStartListeningOn(s, subCall, Ipc::fdnFtpSocket);
}
+ CodeContext::Reset(savedContext);
}
void
Ftp::StopListening()
{
+ const auto savedContext = CodeContext::Current();
for (AnyP::PortCfgPointer s = FtpPortList; s != nullptr; s = s->next) {
+ CodeContext::Reset(s);
if (s->listenConn != nullptr) {
debugs(1, DBG_IMPORTANT, "Closing FTP port " << s->listenConn->local);
s->listenConn->close();
s->listenConn = nullptr;
}
}
+ CodeContext::Reset(savedContext);
}
void