File tree Expand file tree Collapse file tree 1 file changed +10
-13
lines changed
features/cellular/framework/AT Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -530,28 +530,25 @@ nsapi_error_t AT_CellularContext::find_and_activate_context()
530
530
}
531
531
532
532
if (err != NSAPI_ERROR_OK) {
533
- _at.unlock ();
534
533
tr_error (" Failed to activate network context! (%d)" , err);
535
- return err;
536
- }
537
-
538
- // do check for stack to validate that we have support for stack
539
- if (!(_nonip_req && _cp_in_use) && !get_stack ()) {
540
- _at.unlock ();
534
+ } else if (!(_nonip_req && _cp_in_use) && !get_stack ()) {
535
+ // do check for stack to validate that we have support for stack
541
536
tr_error (" No cellular stack!" );
542
- return NSAPI_ERROR_UNSUPPORTED;
537
+ err = NSAPI_ERROR_UNSUPPORTED;
543
538
}
544
539
545
540
_is_context_active = false ;
546
541
_is_context_activated = false ;
547
542
548
- _is_context_active = _nw->is_active_context (NULL , _cid);
543
+ if (err == NSAPI_ERROR_OK) {
544
+ _is_context_active = _nw->is_active_context (NULL , _cid);
549
545
550
- if (!_is_context_active) {
551
- activate_context ();
552
- }
546
+ if (!_is_context_active) {
547
+ activate_context ();
548
+ }
553
549
554
- err = (_at.get_last_error () == NSAPI_ERROR_OK) ? NSAPI_ERROR_OK : NSAPI_ERROR_NO_CONNECTION;
550
+ err = (_at.get_last_error () == NSAPI_ERROR_OK) ? NSAPI_ERROR_OK : NSAPI_ERROR_NO_CONNECTION;
551
+ }
555
552
556
553
// If new PDP context was created and failed to activate, delete it
557
554
if (err != NSAPI_ERROR_OK && _new_context_set) {
You can’t perform that action at this time.
0 commit comments