-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fixed ppp_lwip_disconnect hangs when connection failure. #7160
Conversation
@0xc0170 travis failure not related to this fix, probably ci/pr-head neither. |
my_stream = NULL; | ||
/* close call made, now let's catch the response in the status callback */ | ||
sys_arch_sem_wait(&ppp_close_sem, 0); | ||
ppp_active = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should actually set ppp_active to false even if ppp_close returns an error. It's probably down if that happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, fixed
@jarvte Thanks for that comment. Restarted that Travis job... |
if (ppp_active) { | ||
err_t ret = ppp_close(my_ppp_pcb, 0); | ||
if (ret != ERR_OK) { | ||
ppp_active = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All paths set ppp_active = false;
, could be done once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ppp_active can't be called before sys_arch_sem_wait but did some modifications.
@@ -373,6 +372,9 @@ nsapi_error_t nsapi_ppp_connect(FileHandle *stream, Callback<void(nsapi_event_t, | |||
retcode = lwip._add_ppp_interface(stream, true, stack, &my_interface); | |||
if (retcode != NSAPI_ERROR_OK) { | |||
my_interface = NULL; | |||
my_stream->set_blocking(true); | |||
my_stream = NULL; | |||
connection_status_cb = NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AT_CellularNetwork::open_data_channel should release file handle before calling nsapi_ppp_connect(), and also reinitialise file handle if nsapi_ppp_connect() returns failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By "release" do you mean unset its sigio
callback? Yes, probably wise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to do it here, only after my_interface->bringup which will set sigio. Added unset of sigio there. Good point!
my_stream->set_blocking(true); | ||
my_stream = NULL; | ||
|
||
return retcode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AT_CellularNetwork::disconnect should probably take ownership also in case of if (err != NSAPI_ERROR_OK)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, fixed to AT_Cellularnetwork::disconnect()
a9bec43
to
db5f38b
Compare
- 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 failure
db5f38b
to
b35dc6a
Compare
/morph build |
Build : SUCCESSBuild number : 2308 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 1930 |
Test : SUCCESSBuild number : 2085 |
/morph export-build |
Exporter Build : SUCCESSBuild number : 1932 |
@0xc0170 please merge |
Description
@AriParkkila @kjbracey-arm please review.
Internal ref to defect: IOTCELL-1028
Pull request type