- MMS client: fixed problem when reusing connection

pull/179/head
Michael Zillgith 7 years ago
parent f2c811c7c7
commit 9f8d52005b

@ -1,5 +1,5 @@
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/sqlite/sqlite3.h") if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../third_party/sqlite/sqlite3.h")
message("Found sqlite source code -> compile sqlite-log driver with static sqlite library") message("Found sqlite source code -> compile sqlite-log driver with static sqlite library")
include_directories( include_directories(
@ -10,11 +10,11 @@ include_directories(
set(server_example_SRCS set(server_example_SRCS
server_example_logging.c server_example_logging.c
static_model.c static_model.c
${CMAKE_SOURCE_DIR}/src/logging/drivers/sqlite/log_storage_sqlite.c ${CMAKE_CURRENT_LIST_DIR}/../../src/logging/drivers/sqlite/log_storage_sqlite.c
) )
set(sqlite_SRCS set(sqlite_SRCS
${CMAKE_SOURCE_DIR}/third_party/sqlite/sqlite3.c ${CMAKE_CURRENT_LIST_DIR}/../../third_party/sqlite/sqlite3.c
) )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION")

@ -636,17 +636,21 @@ IsoClientConnection_handleConnection(IsoClientConnection self)
bool bool
IsoClientConnection_associateAsync(IsoClientConnection self, uint32_t connectTimeoutInMs) IsoClientConnection_associateAsync(IsoClientConnection self, uint32_t connectTimeoutInMs)
{ {
Semaphore_wait(self->tickMutex);
/* Create socket and start connect */
self->socket = TcpSocket_create(); self->socket = TcpSocket_create();
if (self->socket == NULL) if (self->socket == NULL) {
Semaphore_post(self->tickMutex);
return false; return false;
}
bool success = true; bool success = true;
/* Create socket and start connect */
setState(self, STATE_CONNECTING); setState(self, STATE_CONNECTING);
setIntState(self, INT_STATE_TCP_CONNECTING);
Semaphore_wait(self->tickMutex);
#if (CONFIG_ACTIVATE_TCP_KEEPALIVE == 1) #if (CONFIG_ACTIVATE_TCP_KEEPALIVE == 1)
Socket_activateTcpKeepAlive(self->socket, Socket_activateTcpKeepAlive(self->socket,
@ -655,8 +659,6 @@ IsoClientConnection_associateAsync(IsoClientConnection self, uint32_t connectTim
CONFIG_TCP_KEEPALIVE_CNT); CONFIG_TCP_KEEPALIVE_CNT);
#endif #endif
setIntState(self, INT_STATE_TCP_CONNECTING);
/* set timeout for connect */ /* set timeout for connect */
self->nextReadTimeout = Hal_getTimeInMs() + connectTimeoutInMs; self->nextReadTimeout = Hal_getTimeInMs() + connectTimeoutInMs;

Loading…
Cancel
Save