Backport client async connect fix from upstream.
This commit is contained in:
parent
ce6645f75a
commit
efe25d0d1c
@ -1,6 +1,7 @@
|
||||
COMMENT = library implementation of OPC UA
|
||||
|
||||
VERSION = 1.3.1
|
||||
REVISION = 0
|
||||
DISTNAME = open62541-${VERSION}
|
||||
PKGNAME = open62541-${VERSION}
|
||||
|
||||
|
15
misc/open62541/patches/patch-arch_network_tcp_c
Normal file
15
misc/open62541/patches/patch-arch_network_tcp_c
Normal file
@ -0,0 +1,15 @@
|
||||
fix(client) connect iterate without timeout
|
||||
https://github.com/open62541/open62541/pull/5204
|
||||
|
||||
Index: arch/network_tcp.c
|
||||
--- arch/network_tcp.c.orig
|
||||
+++ arch/network_tcp.c
|
||||
@@ -825,7 +825,7 @@ UA_ClientConnectionTCP_poll(UA_Connection *connection,
|
||||
tcpConnection->endpointUrl.data, strerror(UA_ERRNO));
|
||||
ClientNetworkLayerTCP_close(connection);
|
||||
return UA_STATUSCODE_BADDISCONNECT;
|
||||
- } else if (ret == 0) {
|
||||
+ } else if (timeout && ret == 0) {
|
||||
UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
|
||||
"Connection to %.*s timed out",
|
||||
(int)tcpConnection->endpointUrl.length,
|
@ -1,6 +1,9 @@
|
||||
fix(tests): network is not instant
|
||||
https://github.com/open62541/open62541/commit/d40ce0724b82a22228b7e5c32b4bb401cb8e7a1c
|
||||
|
||||
fix(client) connect iterate without timeout
|
||||
https://github.com/open62541/open62541/pull/5204
|
||||
|
||||
Index: tests/client/check_client_async_connect.c
|
||||
--- tests/client/check_client_async_connect.c.orig
|
||||
+++ tests/client/check_client_async_connect.c
|
||||
@ -22,3 +25,36 @@ Index: tests/client/check_client_async_connect.c
|
||||
UA_Server_run_iterate(server, false);
|
||||
retval |= UA_Client_run_iterate(client, 0); /* Send HEL */
|
||||
UA_Server_run_iterate(server, false);
|
||||
@@ -169,6 +171,24 @@ START_TEST(Client_without_run_iterate) {
|
||||
}
|
||||
END_TEST
|
||||
|
||||
+START_TEST(Client_run_iterate) {
|
||||
+ UA_StatusCode retval;
|
||||
+ UA_Client *client = UA_Client_new();
|
||||
+ UA_ClientConfig *cc = UA_Client_getConfig(client);
|
||||
+ UA_ClientConfig_setDefault(cc);
|
||||
+ cc->stateCallback = currentState;
|
||||
+ connected = false;
|
||||
+ retval = UA_Client_connectAsync(client, "opc.tcp://localhost:4840");
|
||||
+ ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
|
||||
+ while (!connected) {
|
||||
+ retval = UA_Client_run_iterate(client, 0);
|
||||
+ ck_assert_uint_eq(retval, UA_STATUSCODE_GOOD);
|
||||
+ sleep(0);
|
||||
+ }
|
||||
+ UA_Client_delete(client);
|
||||
+}
|
||||
+END_TEST
|
||||
+
|
||||
static Suite* testSuite_Client(void) {
|
||||
Suite *s = suite_create("Client");
|
||||
TCase *tc_client_connect = tcase_create("Client Connect Async");
|
||||
@@ -177,6 +197,7 @@ static Suite* testSuite_Client(void) {
|
||||
tcase_add_test(tc_client_connect, Client_connect_async_abort);
|
||||
tcase_add_test(tc_client_connect, Client_no_connection);
|
||||
tcase_add_test(tc_client_connect, Client_without_run_iterate);
|
||||
+ tcase_add_test(tc_client_connect, Client_run_iterate);
|
||||
suite_add_tcase(s,tc_client_connect);
|
||||
return s;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user