MXS-1123: Fix connection_timeout causing constant disconnections

In a configuration with multiple services, one with connection_timeout and
others without it, the connections to non-connection_timeout services
would get immediately closed due to integer overflow.
This commit is contained in:
Markus Mäkelä 2017-02-06 23:03:57 +02:00
parent c0f5124f6f
commit e3bed424ea
2 changed files with 5 additions and 3 deletions

View File

@ -1025,7 +1025,9 @@ void process_idle_sessions()
while (all_session)
{
if (all_session->ses_is_in_use &&
all_session->service && all_session->client_dcb && all_session->client_dcb->state == DCB_STATE_POLLING &&
all_session->service && all_session->client_dcb &&
all_session->client_dcb->state == DCB_STATE_POLLING &&
all_session->service->conn_idle_timeout &&
hkheartbeat - all_session->client_dcb->last_read > all_session->service->conn_idle_timeout * 10)
{
dcb_close(all_session->client_dcb);

View File

@ -100,7 +100,7 @@ typedef struct server_ref_t
#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
#define SERVICE_NO_SESSION_TIMEOUT 0
/**
* Parameters that are automatically detected but can also be configured by the
@ -149,7 +149,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 */
long conn_idle_timeout; /**< Session timeout in seconds */
uint64_t conn_idle_timeout; /**< Session timeout in seconds */
char *weightby;
struct service *next; /**< The next service in the linked list */
bool retry_start; /*< If starting of the service should be retried later */