iotivity-lite icon indicating copy to clipboard operation
iotivity-lite copied to clipboard

Multiple calls to oc_do_ip_discovery fail on windows.

Open WAvdBeek opened this issue 3 years ago • 0 comments

Multiple calls to oc_do_ip_discovery fail on windows. Reproduction steps: on windows:

Update simpleclient_windows sample as indicated below. build code. start SimpleServer.exe onboard and provision SimpleServer (recommend using wildcard ACL) so it can be called from the SimpleClient.exe Run SimpleClient.exe (may need to onboard and provision SimpleClient depending on provision settings done for SimpleServer) Expected output:

DISCOVERY 1 CALLED DISCOVERY 2 CALLED Actual output: DISCOVERY 1 CALLED   note: Only the first call to oc_do_ip_discovery is successful.   Code change in the simpleclient_windows sample code static oc_discovery_flags_t discovery1(const char *anchor, const char *uri, oc_string_array_t types, oc_interface_mask_t iface_mask, oc_endpoint_t *endpoint, oc_resource_properties_t bm, void *user_data) { printf("DISCOVERY 1 CALLED\n"); oc_free_server_endpoints(endpoint); return OC_CONTINUE_DISCOVERY; }

static oc_discovery_flags_t discovery2(const char *anchor, const char *uri, oc_string_array_t types, oc_interface_mask_t iface_mask, oc_endpoint_t *endpoint, oc_resource_properties_t bm, void *user_data) { printf("DISCOVERY 2 CALLED\n"); oc_free_server_endpoints(endpoint); return OC_CONTINUE_DISCOVERY; }

static void issue_requests(void) { oc_do_ip_discovery("core.light", &discovery1, NULL); oc_do_ip_discovery("core.light", &discovery2, NULL); }  

JIRA migration meta data

JIRA Issue ID: LITE-83

Reporter: georgen

Assignee: kmaloor

Creator: georgen

Created at: 2019-08-29T14:19:41.000-0700

Found in Version: master

Fix in Version: None

Issue Severity: Major

Reproducibility: Always (100%)

Operating System: Windows

Hardware/ OEM Platform: None

External URL: None

Bugzilla ID: None

Product: None

Status: To Do

Components: base stack

Priority: P3

Due Date: None

Issue Type: Bug END of JIRA migration meta data

There seems to be a timing issue during initialization, particularly with respect to the Windows connectivity layer. On examining the logs, you will find that the send_msg() failed, so the discovery packet wasn't even sent. But if I set a delayed_callback() inside issue_requests() and issued the back to back discoveries inside that callback (after a delay of say 5-10s from issue_requests()), I see that both callbacks are invoked.

WAvdBeek avatar May 12 '21 10:05 WAvdBeek