|
@@ -33,7 +33,6 @@
|
|
|
#include "MessageHandler.h"
|
|
|
#include "sqlite3.h"
|
|
|
|
|
|
-
|
|
|
#ifndef SPEC_LATEST_SUPPORTED
|
|
|
#define SPEC_LATEST_SUPPORTED 13
|
|
|
#endif
|
|
@@ -669,8 +668,9 @@ static struct lws_protocols protocols[] = {
|
|
|
};
|
|
|
|
|
|
|
|
|
-int ConnectWsServer(int WebSocketPingInterval)
|
|
|
+void* ConnectWsServer(void* data) //int ConnectWsServer()
|
|
|
{
|
|
|
+ pthread_detach(pthread_self());
|
|
|
int result = PASS;
|
|
|
struct lws_context_creation_info ContextInfo;
|
|
|
struct lws_client_connect_info ConnInfo;
|
|
@@ -687,7 +687,7 @@ int ConnectWsServer(int WebSocketPingInterval)
|
|
|
{
|
|
|
result = FAIL;
|
|
|
DEBUG_ERROR("OCPP URL is NULL or OCPP Port is zero or OCPP Path is NULL\n");
|
|
|
- return result;
|
|
|
+ //return result;
|
|
|
}
|
|
|
|
|
|
if((strcmp(OcppProtocol,"ws")==0)&&(strlen(OcppProtocol)== 2))
|
|
@@ -716,9 +716,9 @@ int ConnectWsServer(int WebSocketPingInterval)
|
|
|
}
|
|
|
|
|
|
ContextInfo.protocols = protocols;
|
|
|
- ContextInfo.timeout_secs = WebSocketPingInterval;//30;//9999;//30;
|
|
|
+ ContextInfo.timeout_secs = GetWebSocketPingInterval();//WebSocketPingInterval;//30;//9999;//30;
|
|
|
//if(ping pong enabled)
|
|
|
- ContextInfo.ws_ping_pong_interval = WebSocketPingInterval;//30;//0 for none, else interval in seconds
|
|
|
+ ContextInfo.ws_ping_pong_interval = GetWebSocketPingInterval();//WebSocketPingInterval;//30;//0 for none, else interval in seconds
|
|
|
context = lws_create_context(&ContextInfo);
|
|
|
if (context == NULL)
|
|
|
{
|
|
@@ -757,7 +757,8 @@ int ConnectWsServer(int WebSocketPingInterval)
|
|
|
result = FAIL;
|
|
|
}
|
|
|
|
|
|
- return result;
|
|
|
+ pthread_exit(NULL/*(void *) fname*/);
|
|
|
+ //return result;
|
|
|
}
|
|
|
|
|
|
//void createq();
|
|
@@ -1594,6 +1595,7 @@ int main(void)
|
|
|
char rmFileCmd[100]={0};
|
|
|
struct stat stats;
|
|
|
pthread_t t;
|
|
|
+ pthread_t pid;
|
|
|
#ifdef SystemLogMessage
|
|
|
DEBUG_INFO("Initialization...\n");
|
|
|
#endif
|
|
@@ -1704,7 +1706,8 @@ int main(void)
|
|
|
#ifdef Debug
|
|
|
DEBUG_INFO("Execute ConnectWsServer\n");
|
|
|
#endif
|
|
|
- ConnectWsServer(GetWebSocketPingInterval());
|
|
|
+ //ConnectWsServer();
|
|
|
+ pthread_create(&pid, NULL, ConnectWsServer, NULL);
|
|
|
startTime.connect=time((time_t*)NULL);
|
|
|
}
|
|
|
|