-
Notifications
You must be signed in to change notification settings - Fork 176
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
fixing select usage #283
base: master
Are you sure you want to change the base?
fixing select usage #283
Conversation
tls/server-tls-nonblocking.c
Outdated
@@ -52,36 +52,34 @@ enum { | |||
|
|||
static int tcp_select(SOCKET_T socketfd, int to_sec, int rx) |
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.
Since we do not check the return of tcp_select
, it would be better to change the return to a void
. Alternatively, the return of this function should be checked in the main
loop.
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.
Updated to poll() version as Daniele suggested. It looks like behaving as expected.
Will eliminate the return value as soon as debugging is completed.
2b4bc1d
to
8c178cd
Compare
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.
The example looks clear now.
I like the idea of a state machine with a switch-case with these FALL_THROUGH, however sv_main
is a bit too long, perhaps it could be split into more functions for readability.
Please fix the spelling of macros NB_FATAL
and SV_VERBOSE
.
break; | ||
case NB_FAITAL: | ||
sv_free(sv_ctx); | ||
break; |
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.
Shouldn't this be return 1
so that execution is stopped?
Set timeout in tcp_select
timeout.tv_sec = to_sec;
Set non-blocking to "connd", as well.
fcntl(connd, F_SETFL, O_NONBLOCK)
tcp_select(connd,...) for wolfSSL_accept, read, write
make all 3 args non-NULL for select. NULL arg derives error on MacOS.
====
Totally changed to a single polling point.