Added session timeouts.

The parameter 'connection_timeout' for services takes a value as seconds.
All sessions that have been idle for longer than this will be disconnected.
This commit is contained in:
Markus Makela
2015-02-20 22:16:43 +02:00
parent 3145ebac43
commit c47d2f3791
14 changed files with 101 additions and 4 deletions

View File

@ -31,7 +31,7 @@
*/
#include <dcb.h>
#include <spinlock.h>
#include <housekeeper.h>
/**
* The telnetd specific protocol structure to put in the DCB.
*/

View File

@ -61,6 +61,7 @@
#include <users.h>
#include <dbusers.h>
#include <version.h>
#include <housekeeper.h>
#define GW_MYSQL_VERSION "MaxScale " MAXSCALE_VERSION
#define GW_MYSQL_LOOP_TIMEOUT 300000000

View File

@ -30,7 +30,7 @@
* @endverbatim
*/
#include <dcb.h>
#include <housekeeper.h>
/**
* The telnetd specific protocol structure to put in the DCB.
*/

View File

@ -144,6 +144,9 @@ char *password;
if ((n = dcb_read(dcb, &head)) != -1)
{
dcb->last_read = hkheartbeat;
if (head)
{
unsigned char *ptr = GWBUF_DATA(head);

View File

@ -448,6 +448,8 @@ static int gw_read_backend_event(DCB *dcb) {
/* read available backend data */
rc = dcb_read(dcb, &read_buffer);
dcb->last_read = hkheartbeat;
if (rc < 0)
{
GWBUF* errbuf;

View File

@ -576,6 +576,8 @@ int gw_read_client_event(
CHK_PROTOCOL(protocol);
rc = dcb_read(dcb, &read_buffer);
dcb->last_read = hkheartbeat;
if (rc < 0)
{
dcb_close(dcb);

View File

@ -170,6 +170,9 @@ int gw_read_backend_handshake(
if ((n = dcb_read(dcb, &head)) != -1)
{
dcb->last_read = hkheartbeat;
if (head)
{
payload = GWBUF_DATA(head);
@ -420,6 +423,8 @@ int gw_receive_backend_auth(
n = dcb_read(dcb, &head);
dcb->last_read = hkheartbeat;
/*<
* Read didn't fail and there is enough data for mysql packet.
*/

View File

@ -156,6 +156,9 @@ char *password, *t;
if ((n = dcb_read(dcb, &head)) != -1)
{
dcb->last_read = hkheartbeat;
if (head)
{
unsigned char *ptr = GWBUF_DATA(head);