cleanup connections every 10s.
This commit is contained in:
@@ -31,8 +31,9 @@
|
||||
|
||||
//#define WRITE_INTERVAL_IN_SECS (5*60)
|
||||
|
||||
#define WRITE_INTERVAL_IN_SECS (60)
|
||||
#define PING_INTERVAL 120
|
||||
#define WRITE_INTERVAL_IN_SECS 60
|
||||
#define PING_INTERVAL 120
|
||||
#define CONNCLEAN_INTERVAL_IN_SECS 10
|
||||
|
||||
|
||||
|
||||
@@ -133,11 +134,13 @@ void _runService(AQHOME_DATA *aqh)
|
||||
{
|
||||
time_t timeStart;
|
||||
time_t timeLastWrite;
|
||||
time_t timeLastConnectionCleanup;
|
||||
int timeout;
|
||||
|
||||
timeout=AqHomeData_GetTimeout(aqh);
|
||||
timeStart=time(NULL);
|
||||
timeLastWrite=time(NULL);
|
||||
timeLastConnectionCleanup=time(NULL);
|
||||
|
||||
while(!stopService) {
|
||||
time_t now;
|
||||
@@ -147,6 +150,12 @@ void _runService(AQHOME_DATA *aqh)
|
||||
|
||||
now=time(NULL);
|
||||
|
||||
if (((int)difftime(now, timeLastConnectionCleanup))>CONNCLEAN_INTERVAL_IN_SECS) {
|
||||
DBG_INFO(NULL, "Cleanup connections");
|
||||
GWEN_MsgEndpoint_RemoveUnconnectedAndEmptyChildren(AqHomeData_GetIpcdEndpoint(aqh));
|
||||
timeLastConnectionCleanup=now;
|
||||
}
|
||||
|
||||
if (((int)difftime(now, timeLastWrite))>WRITE_INTERVAL_IN_SECS) {
|
||||
DBG_INFO(NULL, "Write time");
|
||||
_writeCurrentState(aqh);
|
||||
|
||||
Reference in New Issue
Block a user