Skip to content

Commit

Permalink
samples: net: download: add graceful iface down
Browse files Browse the repository at this point in the history
Add graceful bring down of the network interfaces.

Signed-off-by: Mirko Covizzi <[email protected]>
  • Loading branch information
MirkoCovizzi authored and nordicjm committed Jan 15, 2024
1 parent 6fcf737 commit 7ca9c73
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,10 @@ Networking samples

* Updated the sample to gracefully bring down the network interfaces.

* :ref:`download_sample` sample:

* Updated the sample to gracefully bring down the network interfaces.

NFC samples
-----------

Expand Down
2 changes: 2 additions & 0 deletions samples/net/download/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ static int callback(const struct download_client_evt *event)
#endif /* CONFIG_SAMPLE_COMPUTE_HASH */

(void)conn_mgr_if_disconnect(net_if);
(void)conn_mgr_all_if_down(true);
printk("Bye\n");
return 0;

Expand All @@ -230,6 +231,7 @@ static int callback(const struct download_client_evt *event)
/* With ECONNRESET, allow library to attempt a reconnect by returning 0 */
} else {
(void)conn_mgr_if_disconnect(net_if);
(void)conn_mgr_all_if_down(true);
/* Stop download */
return -1;
}
Expand Down

0 comments on commit 7ca9c73

Please sign in to comment.