|
@@ -14,7 +14,7 @@ struct StartTime
|
|
|
struct timespec connect;
|
|
|
struct timespec bootNotification;
|
|
|
struct timespec reConnect;
|
|
|
- struct timespec startTimeDog;
|
|
|
+ struct timespec disconnectServer;
|
|
|
struct timespec startTimeQueue;
|
|
|
struct timespec pingOn;
|
|
|
}startTime;
|
|
@@ -37,7 +37,6 @@ unsigned char StartTransactionIdTagTemp[20]={0};
|
|
|
int LastQueuedTransactionId[8] = {0};
|
|
|
uint8_t isWebsocketSendable = 1;
|
|
|
uint8_t isQueueSendable = 1;
|
|
|
-uint8_t counterLwsRestart = 0;
|
|
|
uint8_t counterQueueSent = 0;
|
|
|
uint8_t counterConnect = 0;
|
|
|
uint8_t counterPingSend = 0;
|
|
@@ -1227,21 +1226,10 @@ void* processWatchdog()
|
|
|
{
|
|
|
for(;;)
|
|
|
{
|
|
|
- if((getDiffSecNow(startTime.startTimeDog) > 10) && (context != NULL))
|
|
|
+ if((getDiffSecNow(startTime.disconnectServer) >= 7200))
|
|
|
{
|
|
|
- DEBUG_INFO("LWS watch dog timeout.\n");
|
|
|
- lws_cancel_service(context);
|
|
|
- lws_cancel_service_pt(wsi_client);
|
|
|
-
|
|
|
- if(counterLwsRestart >= 3)
|
|
|
- {
|
|
|
- DEBUG_INFO("LWS watch dog timeout over 3 count.\n");
|
|
|
- system("killall OcppBackend");
|
|
|
- }
|
|
|
- else
|
|
|
- counterLwsRestart++;
|
|
|
-
|
|
|
- refreshStartTimer(&startTime.startTimeDog);
|
|
|
+ DEBUG_INFO("OCPP server disconnect timer(%d) over 7200 seconds.\n", getDiffSecNow(startTime.disconnectServer));
|
|
|
+ system("killall OcppBackend");
|
|
|
}
|
|
|
|
|
|
if(counterConnect >= 3)
|
|
@@ -1395,6 +1383,7 @@ int main(void)
|
|
|
memset(rmFileCmd, 0, ARRAY_SIZE(rmFileCmd));
|
|
|
|
|
|
// Create Process: Resend Transaction
|
|
|
+ refreshStartTimer(&startTime.disconnectServer);
|
|
|
pthread_create(&tid_ProcQueue, NULL, processTransactionQueue, NULL);
|
|
|
pthread_create(&tid_Watchdog, NULL, processWatchdog, NULL);
|
|
|
|
|
@@ -1511,8 +1500,6 @@ int main(void)
|
|
|
|
|
|
for(;;)
|
|
|
{
|
|
|
- refreshStartTimer(&startTime.startTimeDog);
|
|
|
- counterLwsRestart = 0;
|
|
|
// Connect server
|
|
|
if(ConnectionEstablished==0) // Check InternetConn 0: disconnected, 1: connected
|
|
|
{
|
|
@@ -1585,6 +1572,8 @@ int main(void)
|
|
|
{
|
|
|
refreshStartTimer(&startTime.reConnect);
|
|
|
}
|
|
|
+
|
|
|
+ refreshStartTimer(&startTime.disconnectServer);
|
|
|
}
|
|
|
}
|
|
|
|