Skip to content

Commit c9d8d4b

Browse files
committed
fix trigger CS104_CONNECTION_FAILED event, if tlsSocket fails
1 parent 63028a9 commit c9d8d4b

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ handleConnection(void* parameter)
904904
{
905905
CS104_Connection self = (CS104_Connection)parameter;
906906

907-
CS104_ConnectionEvent event = CS104_CONNECTION_OPENED;
907+
CS104_ConnectionEvent event = CS104_CONNECTION_FAILED;
908908

909909
resetConnection(self);
910910

@@ -1065,9 +1065,6 @@ handleConnection(void* parameter)
10651065
#if (CONFIG_USE_SEMAPHORES == 1)
10661066
Semaphore_post(self->conStateLock);
10671067
#endif /* (CONFIG_USE_SEMAPHORES == 1) */
1068-
1069-
/* register CLOSED event */
1070-
event = CS104_CONNECTION_FAILED;
10711068
}
10721069

10731070
#if (CONFIG_USE_SEMAPHORES == 1)
@@ -1115,11 +1112,8 @@ handleConnection(void* parameter)
11151112
}
11161113

11171114
/* Call connection handler */
1118-
if ((event == CS104_CONNECTION_CLOSED) || (event == CS104_CONNECTION_FAILED))
1119-
{
1120-
if (self->connectionHandler)
1121-
self->connectionHandler(self->connectionHandlerParameter, self, event);
1122-
}
1115+
if (self->connectionHandler)
1116+
self->connectionHandler(self->connectionHandlerParameter, self, event);
11231117

11241118
return NULL;
11251119
}

0 commit comments

Comments
 (0)