Skip to content

Commit 1049fea

Browse files
committed
fix trigger CS104_CONNECTION_FAILED event, if tlsSocket fails
1 parent 7d58626 commit 1049fea

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

lib60870-C/src/iec60870/cs104/cs104_connection.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ handleConnection(void* parameter)
865865
{
866866
CS104_Connection self = (CS104_Connection) parameter;
867867

868-
CS104_ConnectionEvent event = CS104_CONNECTION_OPENED;
868+
CS104_ConnectionEvent event = CS104_CONNECTION_FAILED;
869869

870870
resetConnection(self);
871871

@@ -1015,9 +1015,6 @@ handleConnection(void* parameter)
10151015
#if (CONFIG_USE_SEMAPHORES == 1)
10161016
Semaphore_post(self->conStateLock);
10171017
#endif /* (CONFIG_USE_SEMAPHORES == 1) */
1018-
1019-
/* register CLOSED event */
1020-
event = CS104_CONNECTION_FAILED;
10211018
}
10221019

10231020
#if (CONFIG_USE_SEMAPHORES == 1)
@@ -1064,10 +1061,8 @@ handleConnection(void* parameter)
10641061
}
10651062

10661063
/* Call connection handler */
1067-
if ((event == CS104_CONNECTION_CLOSED) || (event == CS104_CONNECTION_FAILED)) {
1068-
if (self->connectionHandler)
1069-
self->connectionHandler(self->connectionHandlerParameter, self, event);
1070-
}
1064+
if (self->connectionHandler)
1065+
self->connectionHandler(self->connectionHandlerParameter, self, event);
10711066

10721067
return NULL;
10731068
}

0 commit comments

Comments
 (0)