xl2tpd-control: fix xl2tpd hanged up in "fopen" #125
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a fix for xl2tpd hanged up in "fopen" result fifo while working on xl2tpd with OpenWrt.
Root cause is as followings,
xl2tpd-control open result fifo ##fifo readers=1
xl2tpd-control read result fifo
xl2tpd-control close result fifo ##fifo readers=0
xl2tpd fopen result fifo ##xl2tpd is hanged up here to wait readers
xl2tpd-control unlink result fifo
The fix replaces the order of "unlink" and "close" when cleaning up to avoid hang up issue in fopen, and add the retry waiting when reading result fifo to wait xl2tpd fopen result fifo.
A refactoring proposal
There is sequence problem using fifo mechanism between xl2tpd and xl2tpd-control.
To solve the problem entirely, It is better to use socket communication between xl2tpd and xl2tpd-control.
This topic had talked with yousong.
But using socket to refactor this is a big change, I hope to get your suggestions.
What do you think about the refactoring proposal?
Thanks.