Fixed idle session processing

The current implementation of idle connection timeouts is not safe. The sessions
are handled in a way which is not thread-safe and the checking is done from
a non-polling thread.

With this change, the checks for the session timeouts are done in one of the
polling threads in a thread-safe manner only if at least one service has enabled
the timing out of idle client connections.
This commit is contained in:
Markus Makela
2016-01-05 06:31:07 +02:00
parent cdeb921b1b
commit c2310327fc
7 changed files with 77 additions and 36 deletions

View File

@ -135,6 +135,10 @@ enum
#define DEFAULT_SSL_CERT_VERIFY_DEPTH 100 /*< The default certificate verification depth */
#define SERVICE_MAX_RETRY_INTERVAL 3600 /*< The maximum interval between service start retries */
/** Value of service timeout if timeout checks are disabled */
#define SERVICE_NO_SESSION_TIMEOUT LONG_MAX
/**
* Parameters that are automatically detected but can also be configured by the
* user are initially set to this value.
@ -180,7 +184,7 @@ typedef struct service
SERVICE_REFRESH_RATE rate_limit; /**< The refresh rate limit for users table */
FILTER_DEF **filters; /**< Ordered list of filters */
int n_filters; /**< Number of filters */
int conn_timeout; /*< Session timeout in seconds */
long conn_idle_timeout; /**< Session timeout in seconds */
ssl_mode_t ssl_mode; /*< one of DISABLED, ENABLED or REQUIRED */
char *weightby;
struct service *next; /**< The next service in the linked list */