return active_connections;
}
+/* Increment/decrement the number of active connections. */
+static void
+adjust_agent_active_connections (int delta)
+{
+ active_connections += delta;
+}
+
/* Under W32, this function returns the handle of the scdaemon
notification event. Calling it the first time creates that
log_info ("SIGTERM received - shutting down ...\n");
else
log_info ("SIGTERM received - still %i open connections\n",
- active_connections);
+ get_agent_active_connection_count());
shutdown_pending++;
if (shutdown_pending > 2)
{
static void *
do_start_connection_thread (ctrl_t ctrl)
{
- active_connections++;
+ adjust_agent_active_connections(+1);
agent_init_default_ctrl (ctrl);
if (opt.verbose && !DBG_IPC)
log_info (_("handler 0x%lx for fd %d started\n"),
agent_deinit_default_ctrl (ctrl);
xfree (ctrl);
- active_connections--;
+ adjust_agent_active_connections(-1);
return NULL;
}
if (check_nonce (ctrl, &socket_nonce_ssh))
return NULL;
- active_connections++;
+ adjust_agent_active_connections(+1);
agent_init_default_ctrl (ctrl);
if (opt.verbose)
log_info (_("ssh handler 0x%lx for fd %d started\n"),
agent_deinit_default_ctrl (ctrl);
xfree (ctrl);
- active_connections--;
+ adjust_agent_active_connections(-1);
return NULL;
}
/* Shutdown test. */
if (shutdown_pending)
{
- if (active_connections == 0)
+ if (get_agent_active_connection_count() == 0)
break; /* ready */
/* Do not accept new connections but keep on running the