addressing a TODO.
No Squid functionality changes are expected.
basicauthenticators->ipc_type = IPC_STREAM;
- helperOpenServers(basicauthenticators);
+ basicauthenticators->openSessions();
}
}
digestauthenticators->ipc_type = IPC_STREAM;
- helperOpenServers(digestauthenticators);
+ digestauthenticators->openSessions();
}
}
negotiateauthenticators->ipc_type = IPC_STREAM;
- helperStatefulOpenServers(negotiateauthenticators);
+ negotiateauthenticators->openSessions();
}
}
ntlmauthenticators->ipc_type = IPC_STREAM;
- helperStatefulOpenServers(ntlmauthenticators);
+ ntlmauthenticators->openSessions();
}
}
p->theHelper->addr = p->local_addr;
- helperOpenServers(p->theHelper);
+ p->theHelper->openSessions();
}
externalAclRegisterWithCacheManager();
}
void
-helperOpenServers(const Helper::Client::Pointer &hlp)
+Helper::Client::openSessions()
{
char *s;
char *progname;
int wfd;
void * hIpc;
wordlist *w;
+ // Helps reducing diff. TODO: remove
+ const auto hlp = this;
if (hlp->cmdline == nullptr)
return;
helperKickQueue(hlp);
}
-/**
- * DPW 2007-05-08
- *
- * helperStatefulOpenServers: create the stateful child helper processes
- */
void
-helperStatefulOpenServers(const statefulhelper::Pointer &hlp)
+statefulhelper::openSessions()
{
char *shortname;
const char *args[HELPER_MAX_ARGS+1]; // save space for a NULL terminator
char fd_note_buf[FD_DESC_SZ];
int nargs = 0;
+ // Helps reducing diff. TODO: remove
+ const auto hlp = this;
if (hlp->cmdline == nullptr)
return;
}
void
-Helper::Session::HelperServerClosed(Session * const srv)
+Helper::Client::sessionClosed(SessionBase &session)
{
- const auto hlp = srv->parent;
-
bool needsNewServers = false;
- hlp->handleKilledServer(srv, needsNewServers);
+ handleKilledServer(&session, needsNewServers);
if (needsNewServers) {
debugs(80, DBG_IMPORTANT, "Starting new helpers");
- helperOpenServers(hlp);
+ openSessions();
}
+}
+void
+Helper::Session::HelperServerClosed(Session * const srv)
+{
+ srv->parent->sessionClosed(*srv);
srv->dropQueued();
-
delete srv;
}
-// XXX: Almost duplicates Helper::Session::HelperServerClosed() because helperOpenServers() is not a virtual method of the `Helper::Client` class
-// TODO: Fix the `Helper::Client` class hierarchy to use virtual functions.
+// XXX: Essentially duplicates Helper::Session::HelperServerClosed() until we add SessionBase::helper().
void
helper_stateful_server::HelperServerClosed(helper_stateful_server *srv)
{
- const auto hlp = srv->parent;
-
- bool needsNewServers = false;
- hlp->handleKilledServer(srv, needsNewServers);
- if (needsNewServers) {
- debugs(80, DBG_IMPORTANT, "Starting new helpers");
- helperStatefulOpenServers(hlp);
- }
-
+ srv->parent->sessionClosed(*srv);
srv->dropQueued();
-
delete srv;
}
/* do this first so idle=N has a chance to grow the child pool before it hits critical. */
if (hlp->childs.needNew() > 0) {
- debugs(84, DBG_CRITICAL, "Starting new " << hlp->id_name << " helpers...");
- helperOpenServers(hlp);
+ hlp->openSessions();
return;
}
/* do this first so idle=N has a chance to grow the child pool before it hits critical. */
if (hlp->childs.needNew() > 0) {
- debugs(84, DBG_CRITICAL, "Starting new " << hlp->id_name << " helpers...");
- helperStatefulOpenServers(hlp);
+ hlp->openSessions();
return;
}
/// \param madeProgress whether the died helper(s) responded to any requests
void handleFewerServers(bool madeProgress);
+ /// Starts required helper process(es).
+ /// The caller is responsible for checking that new processes are needed.
+ virtual void openSessions();
+
+ /// handles exited helper process
+ void sessionClosed(SessionBase &);
+
public:
wordlist *cmdline = nullptr;
dlink_list servers;
/// undo reserveServer(), clear the reservation and kick the queue
void cancelReservation(const Helper::ReservationId reservation);
+ /* Helper::Client API */
+ void openSessions() override;
+
private:
friend void helperStatefulSubmit(const statefulhelper::Pointer &, const char *buf, HLPCB *, void *cbData, const Helper::ReservationId &);
time_t reservationStart; ///< when the last `reservation` was made
};
-void helperOpenServers(const Helper::Client::Pointer &);
-void helperStatefulOpenServers(const statefulhelper::Pointer &);
void helperSubmit(const Helper::Client::Pointer &, const char *buf, HLPCB *, void *cbData);
void helperStatefulSubmit(const statefulhelper::Pointer &, const char *buf, HLPCB *, void *cbData, uint64_t reservation);
void helperShutdown(const Helper::Client::Pointer &);
if (Config.onUrlRewriteTimeout.action == toutActUseConfiguredResponse)
redirectors->onTimedOutResponse.assign(Config.onUrlRewriteTimeout.response);
- helperOpenServers(redirectors);
+ redirectors->openSessions();
}
if (Config.Program.store_id) {
storeIds->retryBrokenHelper = true; // XXX: make this configurable ?
- helperOpenServers(storeIds);
+ storeIds->openSessions();
}
if (Config.redirector_extras) {
}
safe_free(tmp_begin);
}
- helperOpenServers(ssl_crtd);
+ ssl_crtd->openSessions();
}
void Ssl::Helper::Shutdown()
}
xfree(tmp_begin);
}
- helperOpenServers(ssl_crt_validator);
+ ssl_crt_validator->openSessions();
//WARNING: initializing static member in an object initialization method
assert(HelperCache == nullptr);
void helperStatefulSubmit(const statefulhelper::Pointer &, const char *, HLPCB *, void *, const Helper::ReservationId &) STUB
Helper::Client::~Client() STUB
void Helper::Client::packStatsInto(Packable *, const char *) const STUB
+void Helper::Client::openSessions() STUB
void helperShutdown(const Helper::Client::Pointer &) STUB
void helperStatefulShutdown(const statefulhelper::Pointer &) STUB
-void helperOpenServers(const Helper::Client::Pointer &) STUB
-void helperStatefulOpenServers(const statefulhelper::Pointer &) STUB
+void statefulhelper::openSessions() STUB