#include "acl/Acl.h"
#include "acl/FilledChecklist.h"
#include "base/AsyncCallbacks.h"
+#include "base/RunnersRegistry.h"
#include "CachePeer.h"
#include "CachePeers.h"
#include "comm.h"
Comm::SetSelect(fd, COMM_SELECT_READ, htcpRecv, nullptr, 0);
}
-/*
- * ======================================================================
- * PUBLIC FUNCTIONS
- * ======================================================================
- */
-
-void
-htcpOpenPorts(void)
+static void
+htcpOpenPorts()
{
+ if (!IamWorkerProcess())
+ return;
+
if (Config.Port.htcp <= 0) {
debugs(31, Important(21), "HTCP Disabled.");
return;
* htcpSocketShutdown only closes the 'in' socket if it is
* different than the 'out' socket.
*/
-void
-htcpSocketShutdown(void)
+static void
+htcpSocketShutdown()
{
if (!Comm::IsConnOpen(htcpIncomingConn))
return;
Comm::SetSelect(htcpOutgoingConn->fd, COMM_SELECT_READ, nullptr, nullptr, 0);
}
-void
-htcpClosePorts(void)
+static void
+htcpClosePorts()
{
+ if (!IamWorkerProcess())
+ return;
+
htcpSocketShutdown();
if (htcpOutgoingConn != nullptr) {
}
}
+class HtcpRr : public RegisteredRunner
+{
+public:
+ void useConfig() override { htcpOpenPorts(); }
+ void startReconfigure() override { htcpClosePorts(); }
+ void syncConfig() override { htcpOpenPorts(); }
+ void startShutdown() override { htcpClosePorts(); }
+};
+DefineRunnerRegistrator(HtcpRr);
+
static void
htcpLogHtcp(Ip::Address &caddr, const int opcode, const LogTags_ot logcode, const char *url, AccessLogEntryPointer al)
{
/// \ingroup ServerProtocolHTCP
void neighborsHtcpReply(const cache_key *, HtcpReplyData *, const Ip::Address &);
-/// \ingroup ServerProtocolHTCP
-void htcpOpenPorts(void);
-
class CachePeer;
/**
/// \ingroup ServerProtocolHTCP
void htcpClear(StoreEntry * e, HttpRequest * req, const HttpRequestMethod &method, CachePeer * p, htcp_clr_reason reason);
-/// \ingroup ServerProtocolHTCP
-void htcpSocketShutdown(void);
-
-/// \ingroup ServerProtocolHTCP
-void htcpClosePorts(void);
-
#endif /* USE_HTCP */
-
#endif /* SQUID_SRC_HTCP_H */
#include "fs_io.h"
#include "FwdState.h"
#include "globals.h"
-#include "htcp.h"
#include "http/Stream.h"
#include "HttpHeader.h"
#include "HttpReply.h"
if (IamWorkerProcess()) {
clientOpenListenSockets();
icpOpenPorts();
-#if USE_HTCP
- htcpOpenPorts();
-#endif
icmpEngine.Open();
netdbInit();
Acl::Node::Initialize();
if (IamWorkerProcess()) {
clientConnectionsClose();
icpConnectionShutdown();
-#if USE_HTCP
- htcpSocketShutdown();
-#endif
-
icmpEngine.Close();
}
}
// Initiate asynchronous closing sequence
serverConnectionsClose();
icpClosePorts();
-#if USE_HTCP
- htcpClosePorts();
-#endif
#if USE_OPENSSL
Ssl::TheGlobalContextStorage().reconfigureStart();
#endif
#if USE_AUTH
CallRunnerRegistrator(PeerUserHashRr);
#endif
-
+#if USE_HTCP
+ CallRunnerRegistrator(HtcpRr);
+#endif
#if USE_OPENSSL
CallRunnerRegistrator(sslBumpCfgRr);
#endif
redirectShutdown();
externalAclShutdown();
icpClosePorts();
-#if USE_HTCP
- htcpClosePorts();
-#endif
releaseServerSockets();
commCloseAllSockets();