Skip to content

Commit b2b2fce

Browse files
authored
Merge pull request ARMmbed#10375 from AriParkkila/cell-context-cleanup
Cellular: Fix to delete PDP context on disconnect
2 parents 85926e8 + 79c5437 commit b2b2fce

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

features/cellular/framework/AT/AT_CellularContext.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,10 @@ nsapi_error_t AT_CellularContext::disconnect()
687687
{
688688
tr_info("CellularContext disconnect()");
689689
if (!_nw || !_is_connected) {
690+
if (_new_context_set) {
691+
delete_current_context();
692+
}
693+
_cid = -1;
690694
return NSAPI_ERROR_NO_CONNECTION;
691695
}
692696

@@ -716,6 +720,11 @@ nsapi_error_t AT_CellularContext::disconnect()
716720
// call device's callback, it will broadcast this to here (cellular_callback)
717721
_device->cellular_callback(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, NSAPI_STATUS_DISCONNECTED, this);
718722

723+
if (_new_context_set) {
724+
delete_current_context();
725+
}
726+
_cid = -1;
727+
719728
return _at.unlock_return_error();
720729
}
721730

0 commit comments

Comments
 (0)