Skip to content

Cellular: Fix to delete PDP context on disconnect #10375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions features/cellular/framework/AT/AT_CellularContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete_current_context() sets _cid to -1 only in successful case. What is the meaning of this line?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disconnect must be set _cid = -1 to not expect any _cid to be valid/preferred on the next connect request, even when we did not create that _cid ourselves.

return NSAPI_ERROR_NO_CONNECTION;
}

Expand Down Expand Up @@ -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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above


return _at.unlock_return_error();
}

Expand Down