client-coap.c: Fix client spin loop for NO_SYS == 0

Do not call coap_free_context() from within sigint handler.
Always call coap_io_process().
Use sys_arch_sem_wait() for timeouts while waiting for input.
This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2024-07-19 10:05:30 +01:00
1 parent f4094636ab
commit bd32823746
6 files changed
+62 -8

No files matched your search

-2
View File
@@ -239,8 +239,6 @@ client_coap_finished(void) {
int
client_coap_poll(void) {
#if NO_SYS
coap_io_process(main_coap_context, 1000);
#endif /* NO_SYS */
return quit;
}
+1 -3
View File
@@ -53,9 +53,7 @@ static void
handle_sigint(int signum) {
(void)signum;
client_coap_finished();
printf("Client Application finished.\n");
exit(0);
quit = 1;
}
/*
+7
View File
@@ -10,6 +10,13 @@
* of use.
*/
/*
* NO_SYS = 0
* Use lwIP OS-awareness (multi threaded, semaphores, mutexes and mboxes).
*
* NO_SYS = 1
* Use lwIP without OS-awareness (no thread, semaphores, mutexes or mboxes).
*/
#define NO_SYS 0
#define LWIP_SOCKET (NO_SYS==0)
#define LWIP_NETCONN (NO_SYS==0)