-
Notifications
You must be signed in to change notification settings - Fork 217
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
[dtls] address race with fd isset #90
[dtls] address race with fd isset #90
Conversation
…P-158-border-router-git-ignore-missing-non-existent to master * commit '80ac484a1cb85ecfee9012dfa2f44af6da1077af': TIOP-158 | Add gitignore files
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.
Could you please also add the missing aContext.mDtlsServer->Start();
call in https://github.com/openthread/borderrouter/blob/master/tests/meshcop/commissioner.cpp#L643
src/agent/dtls_mbedtls.cpp
Outdated
sockaddr_in6 src; | ||
sockaddr_in6 dst; | ||
struct msghdr msghdr; | ||
struct iovec iov[1]; | ||
|
||
VerifyOrExit(FD_ISSET(mSocket, &aReadFdSet)); | ||
/* Connection is not alive yet, or is shut down */ | ||
if (mSocket < 0) |
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.
Is it possible to replace line 499~503 with one line as follows
VerifyOrExit(mSocket >=0, error = OTBR_ERROR_NONE);
This helps improving the code coverage.
src/agent/dtls_mbedtls.cpp
Outdated
} | ||
|
||
/* If this is nto set, then some other handle became rd/wr able. */ | ||
if (!FD_ISSET(mSocket, &aReadFdSet)) |
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.
Same as above, prefer using VerifyOrExit()
style.
Done - I need to leave now, the automated tests take about 30 minutes... I'll check back later tonight from home. |
src/agent/dtls_mbedtls.cpp
Outdated
ExitNow(error = OTBR_ERROR_NONE); | ||
} | ||
/* If this is not set, then some other handle became rd/wr able, it is not an error */ | ||
VerifyOrExit( FD_ISSET(mSocket, &aReadFdSet), error = OTBR_ERROR_NONE); |
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.
nit: extra space.
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.
nit fixed
Resolves #87
Which is a race condition that causes commissioning to fail.