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

[dtls] address race with fd isset #90

Merged
merged 11 commits into from
Aug 16, 2017

Conversation

DuaneEllis-TI
Copy link
Contributor

Resolves #87
Which is a race condition that causes commissioning to fail.

Copy link
Member

@bukepo bukepo left a 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

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)
Copy link
Member

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.

}

/* If this is nto set, then some other handle became rd/wr able. */
if (!FD_ISSET(mSocket, &aReadFdSet))
Copy link
Member

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.

@DuaneEllis-TI
Copy link
Contributor Author

Done - I need to leave now, the automated tests take about 30 minutes... I'll check back later tonight from home.

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);
Copy link
Member

Choose a reason for hiding this comment

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

nit: extra space.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nit fixed

@jwhui jwhui changed the title Issue 87 problem with fd isset [dtls] address race with fd isset Aug 16, 2017
@jwhui jwhui merged commit 4f29337 into openthread:master Aug 16, 2017
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.

None yet

4 participants