HelperChildConfig &
HelperChildConfig::operator =(const HelperChildConfig &rhs)
{
- memcpy(this, &rhs, sizeof(HelperChildConfig));
+ // Copies everything.
+ n_max = rhs.n_max;
+ n_startup = rhs.n_startup;
+ n_idle = rhs.n_idle;
+ concurrency = rhs.concurrency;
+ n_running = rhs.n_running;
+ n_active = rhs.n_active;
+ return *this;
+}
+
+HelperChildConfig &
+HelperChildConfig::updateLimits(const HelperChildConfig &rhs)
+{
+ // Copy the limits only.
+ // Preserve the local state values (n_running and n_active)
+ n_max = rhs.n_max;
+ n_startup = rhs.n_startup;
+ n_idle = rhs.n_idle;
+ concurrency = rhs.concurrency;
return *this;
}
~HelperChildConfig();
HelperChildConfig &operator =(const HelperChildConfig &rhs);
- /*
+ /**
* When new helpers are needed call this to find out how many more
* we are allowed to start.
* \retval 0 No more helpers may be started right now.
int needNew() const;
void parseConfig();
+ /**
+ * Update an existing set of details with new start/max/idle/concurrent limits.
+ * This is for parsing new child settings into an object incrementally then updating
+ * the running set without loosing any of the active state or causing races.
+ */
+ HelperChildConfig &updateLimits(const HelperChildConfig &rhs);
+
/* values from squid.conf */
public:
basicauthenticators->cmdline = authenticateProgram;
- basicauthenticators->childs = authenticateChildren;
+ basicauthenticators->childs.updateLimits(authenticateChildren);
basicauthenticators->ipc_type = IPC_STREAM;
digestauthenticators->cmdline = authenticateProgram;
- digestauthenticators->childs = authenticateChildren;
+ digestauthenticators->childs.updateLimits(authenticateChildren);
digestauthenticators->ipc_type = IPC_STREAM;
negotiateauthenticators->cmdline = authenticateProgram;
- negotiateauthenticators->childs = authenticateChildren;
+ negotiateauthenticators->childs.updateLimits(authenticateChildren);
negotiateauthenticators->ipc_type = IPC_STREAM;
ntlmauthenticators->cmdline = authenticateProgram;
- ntlmauthenticators->childs = authenticateChildren;
+ ntlmauthenticators->childs.updateLimits(authenticateChildren);
ntlmauthenticators->ipc_type = IPC_STREAM;
if (dnsservers == NULL)
dnsservers = new helper("dnsserver");
- dnsservers->childs = Config.dnsChildren;
+ dnsservers->childs.updateLimits(Config.dnsChildren);
dnsservers->ipc_type = IPC_STREAM;
p->theHelper->cmdline = p->cmdline;
- p->theHelper->childs = p->children;
+ p->theHelper->childs.updateLimits(p->children);
p->theHelper->ipc_type = IPC_TCP_SOCKET;
redirectors->cmdline = Config.Program.redirect;
- redirectors->childs = Config.redirectChildren;
+ redirectors->childs.updateLimits(Config.redirectChildren);
redirectors->ipc_type = IPC_STREAM;
return;
ssl_crtd = new helper("ssl_crtd");
- ssl_crtd->childs = Ssl::TheConfig.ssl_crtdChildren;
+ ssl_crtd->childs.updateLimits(Ssl::TheConfig.ssl_crtdChildren);
ssl_crtd->ipc_type = IPC_STREAM;
// The crtd messages may contain the eol ('\n') character. We are
// going to use the '\1' char as the end-of-message mark.