Skip to content

Commit b861460

Browse files
rluboskartben
authored andcommitted
samples: net: sockets: coap_download: Cancel requests before closing
Call coap_client_cancel_requests() before closing the client socket so that all activities on that socket are ceased before close. This prevents POLLNVAL error from being thrown by the coap_client thread and error being printed in the sample output. Signed-off-by: Robert Lubos <[email protected]>
1 parent 7ccf870 commit b861460

File tree

1 file changed

+2
-0
lines changed
  • samples/net/sockets/coap_download/src

1 file changed

+2
-0
lines changed

samples/net/sockets/coap_download/src/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ static void do_coap_download(struct sockaddr *sa)
8282
/* Wait for CoAP request to complete */
8383
k_sem_take(&coap_done_sem, K_FOREVER);
8484

85+
coap_client_cancel_requests(&client);
86+
8587
zsock_close(sockfd);
8688
}
8789

0 commit comments

Comments
 (0)