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

@ -57,6 +57,7 @@
#include <log_manager.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <housekeeper.h>
/** Defined in log_manager.cc */
extern int lm_enabled_logfiles_bitmask;
@ -431,6 +432,8 @@ int listeners = 0;
service->stats.started = time(0);
}
hktask_add("connection_timeout",session_close_timeouts,NULL,5);
return listeners;
}
@ -803,6 +806,23 @@ serviceEnableRootUser(SERVICE *service, int action)
return 1;
}
/**
* Sets the session timeout for the service.
* @param service Service to configure
* @param val Timeout in seconds
* @return 1 on success, 0 when the value is invalid
*/
int
serviceSetTimeout(SERVICE *service, int val)
{
if(val < 0)
return 0;
service->conn_timeout = val;
return 1;
}
/**
* Trim whitespace from the from an rear of a string
*