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 <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
7ccf870670
commit
b8614607d4
1 changed files with 2 additions and 0 deletions
|
@ -82,6 +82,8 @@ static void do_coap_download(struct sockaddr *sa)
|
|||
/* Wait for CoAP request to complete */
|
||||
k_sem_take(&coap_done_sem, K_FOREVER);
|
||||
|
||||
coap_client_cancel_requests(&client);
|
||||
|
||||
zsock_close(sockfd);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue