From 7b73a7f7fc2d50011cbb4f96bea28e2beafc4c5b Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Wed, 17 Oct 2018 11:30:31 +0200 Subject: [PATCH] - CS 104 connection: set state variables in connect function to address problem (#34) --- lib60870-C/src/iec60870/cs104/cs104_connection.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib60870-C/src/iec60870/cs104/cs104_connection.c b/lib60870-C/src/iec60870/cs104/cs104_connection.c index da0b18c1..2593526d 100644 --- a/lib60870-C/src/iec60870/cs104/cs104_connection.c +++ b/lib60870-C/src/iec60870/cs104/cs104_connection.c @@ -799,6 +799,10 @@ handleConnection(void* parameter) void CS104_Connection_connectAsync(CS104_Connection self) { + self->running = false; + self->failure = false; + self->close = false; + #if (CONFIG_USE_THREADS == 1) self->connectionHandlingThread = Thread_create(handleConnection, (void*) self, false); @@ -810,6 +814,10 @@ CS104_Connection_connectAsync(CS104_Connection self) bool CS104_Connection_connect(CS104_Connection self) { + self->running = false; + self->failure = false; + self->close = false; + CS104_Connection_connectAsync(self); while ((self->running == false) && (self->failure == false))