Cellular: Fix to delete PDP context on disconnect

pull/10375/head
Ari Parkkila 2019-04-11 03:58:56 -07:00
parent d9ad62e82f
commit 79c54372f2
1 changed files with 9 additions and 0 deletions

View File

@ -687,6 +687,10 @@ nsapi_error_t AT_CellularContext::disconnect()
{
tr_info("CellularContext disconnect()");
if (!_nw || !_is_connected) {
if (_new_context_set) {
delete_current_context();
}
_cid = -1;
return NSAPI_ERROR_NO_CONNECTION;
}
@ -716,6 +720,11 @@ nsapi_error_t AT_CellularContext::disconnect()
// call device's callback, it will broadcast this to here (cellular_callback)
_device->cellular_callback(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, NSAPI_STATUS_DISCONNECTED, this);
if (_new_context_set) {
delete_current_context();
}
_cid = -1;
return _at.unlock_return_error();
}