mirror of https://github.com/ARMmbed/mbed-os.git
Review fix:
- set ppp_active false if close fails in ppp disconnect. - unset sigio in ppp disconnect - take ownership of filehandle in CellularNetwork::disconnect even in case of failurepull/7160/head
parent
dab4215a9a
commit
b35dc6a582
|
@ -295,18 +295,16 @@ extern "C" err_t ppp_lwip_connect(void *pcb)
|
||||||
|
|
||||||
extern "C" err_t ppp_lwip_disconnect(void *pcb)
|
extern "C" err_t ppp_lwip_disconnect(void *pcb)
|
||||||
{
|
{
|
||||||
|
err_t ret = ERR_OK;
|
||||||
if (ppp_active) {
|
if (ppp_active) {
|
||||||
err_t ret = ppp_close(my_ppp_pcb, 0);
|
ret = ppp_close(my_ppp_pcb, 0);
|
||||||
if (ret != ERR_OK) {
|
if (ret == ERR_OK) {
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* close call made, now let's catch the response in the status callback */
|
/* close call made, now let's catch the response in the status callback */
|
||||||
sys_arch_sem_wait(&ppp_close_sem, 0);
|
sys_arch_sem_wait(&ppp_close_sem, 0);
|
||||||
|
}
|
||||||
ppp_active = false;
|
ppp_active = false;
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
return ERR_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" nsapi_error_t ppp_lwip_if_init(void *pcb, struct netif *netif, const nsapi_ip_stack_t stack)
|
extern "C" nsapi_error_t ppp_lwip_if_init(void *pcb, struct netif *netif, const nsapi_ip_stack_t stack)
|
||||||
|
@ -384,6 +382,7 @@ nsapi_error_t nsapi_ppp_connect(FileHandle *stream, Callback<void(nsapi_event_t,
|
||||||
|
|
||||||
if (retcode != NSAPI_ERROR_OK) {
|
if (retcode != NSAPI_ERROR_OK) {
|
||||||
connection_status_cb = NULL;
|
connection_status_cb = NULL;
|
||||||
|
my_stream->sigio(NULL);
|
||||||
my_stream->set_blocking(true);
|
my_stream->set_blocking(true);
|
||||||
my_stream = NULL;
|
my_stream = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -374,11 +374,9 @@ nsapi_error_t AT_CellularNetwork::disconnect()
|
||||||
nsapi_error_t err = nsapi_ppp_disconnect(_at.get_file_handle());
|
nsapi_error_t err = nsapi_ppp_disconnect(_at.get_file_handle());
|
||||||
// after ppp disconnect if we wan't to use same at handler we need to set filehandle again to athandler so it
|
// after ppp disconnect if we wan't to use same at handler we need to set filehandle again to athandler so it
|
||||||
// will set the correct sigio and nonblocking
|
// will set the correct sigio and nonblocking
|
||||||
if (err == NSAPI_ERROR_OK) {
|
|
||||||
_at.lock();
|
_at.lock();
|
||||||
_at.set_file_handle(_at.get_file_handle());
|
_at.set_file_handle(_at.get_file_handle());
|
||||||
_at.unlock();
|
_at.unlock();
|
||||||
}
|
|
||||||
return err;
|
return err;
|
||||||
#else
|
#else
|
||||||
_at.lock();
|
_at.lock();
|
||||||
|
|
Loading…
Reference in New Issue