posix: close fd on network down

This commit is contained in:
Matthias Ringwald 2019-04-26 16:09:35 +02:00
parent 0c26301252
commit bc8e805046

View File

@ -251,7 +251,7 @@ int btstack_network_up(bd_addr_t network_address){
btstack_run_loop_add_data_source(&tap_dev_ds);
btstack_run_loop_enable_data_source_callbacks(&tap_dev_ds, DATA_SOURCE_CALLBACK_READ);
return 0;;
return 0;
}
/**
@ -264,13 +264,16 @@ const char * btstack_network_get_name(void){
}
/**
* @brief Bring up network interfacd
* @brief Bring up network interface
* @param network_address
* @return 0 if ok
*/
int btstack_network_down(void){
log_info("BNEP channel closed");
btstack_run_loop_remove_data_source(&tap_dev_ds);
if (tap_fd >= 0){
close(tap_fd);
}
tap_fd = -1;
return 0;
}