Skip to content
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

Merged
merged 2 commits into from
Jun 11, 2018

Conversation

jarvte
Copy link
Contributor

@jarvte jarvte commented Jun 7, 2018

Description

@AriParkkila @kjbracey-arm please review.

Internal ref to defect: IOTCELL-1028

Pull request type

[X] Fix
[ ] Refactor
[ ] New target
[ ] Feature
[ ] Breaking change

@jarvte
Copy link
Contributor Author

jarvte commented Jun 7, 2018

@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;
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true, fixed

@cmonr
Copy link
Contributor

cmonr commented Jun 7, 2018

@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;

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?

Copy link
Contributor Author

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;

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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;

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)

Copy link
Contributor Author

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()

@jarvte jarvte force-pushed the ppp_lwip_disconnect_hangs branch from a9bec43 to db5f38b Compare June 8, 2018 09:28
- 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
@jarvte jarvte force-pushed the ppp_lwip_disconnect_hangs branch from db5f38b to b35dc6a Compare June 8, 2018 09:30
@0xc0170
Copy link
Contributor

0xc0170 commented Jun 10, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jun 10, 2018

Build : SUCCESS

Build number : 2308
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/7160/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Jun 10, 2018

@mbed-ci
Copy link

mbed-ci commented Jun 11, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 11, 2018

/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Jun 11, 2018

@jarvte
Copy link
Contributor Author

jarvte commented Jun 11, 2018

@0xc0170 please merge

@cmonr cmonr merged commit de99c0f into ARMmbed:master Jun 11, 2018
@jarvte jarvte deleted the ppp_lwip_disconnect_hangs branch June 20, 2018 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants