- Fix windows tcp and tls spin on events.

git-svn-id: file:///svn/unbound/trunk@4696 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2018-05-28 12:30:34 +00:00
parent d32fb26adb
commit 6792d2d036
2 changed files with 7 additions and 3 deletions

View file

@ -1,3 +1,6 @@
28 May 2018: Wouter
- Fix windows tcp and tls spin on events.
25 May 2018: Wouter 25 May 2018: Wouter
- For TCP and TLS connections that don't establish, perform address - For TCP and TLS connections that don't establish, perform address
update in infra cache, so future selections can exclude them. update in infra cache, so future selections can exclude them.

View file

@ -842,20 +842,21 @@ int comm_point_perform_accept(struct comm_point* c,
static long win_bio_cb(BIO *b, int oper, const char* ATTR_UNUSED(argp), static long win_bio_cb(BIO *b, int oper, const char* ATTR_UNUSED(argp),
int ATTR_UNUSED(argi), long argl, long retvalue) int ATTR_UNUSED(argi), long argl, long retvalue)
{ {
int wsa_err = WSAGetLastError(); /* store errcode before it is gone */
verbose(VERB_ALGO, "bio_cb %d, %s %s %s", oper, verbose(VERB_ALGO, "bio_cb %d, %s %s %s", oper,
(oper&BIO_CB_RETURN)?"return":"before", (oper&BIO_CB_RETURN)?"return":"before",
(oper&BIO_CB_READ)?"read":((oper&BIO_CB_WRITE)?"write":"other"), (oper&BIO_CB_READ)?"read":((oper&BIO_CB_WRITE)?"write":"other"),
WSAGetLastError()==WSAEWOULDBLOCK?"wsawb":""); wsa_err==WSAEWOULDBLOCK?"wsawb":"");
/* on windows, check if previous operation caused EWOULDBLOCK */ /* on windows, check if previous operation caused EWOULDBLOCK */
if( (oper == (BIO_CB_READ|BIO_CB_RETURN) && argl == 0) || if( (oper == (BIO_CB_READ|BIO_CB_RETURN) && argl == 0) ||
(oper == (BIO_CB_GETS|BIO_CB_RETURN) && argl == 0)) { (oper == (BIO_CB_GETS|BIO_CB_RETURN) && argl == 0)) {
if(WSAGetLastError() == WSAEWOULDBLOCK) if(wsa_err == WSAEWOULDBLOCK)
ub_winsock_tcp_wouldblock((struct ub_event*) ub_winsock_tcp_wouldblock((struct ub_event*)
BIO_get_callback_arg(b), UB_EV_READ); BIO_get_callback_arg(b), UB_EV_READ);
} }
if( (oper == (BIO_CB_WRITE|BIO_CB_RETURN) && argl == 0) || if( (oper == (BIO_CB_WRITE|BIO_CB_RETURN) && argl == 0) ||
(oper == (BIO_CB_PUTS|BIO_CB_RETURN) && argl == 0)) { (oper == (BIO_CB_PUTS|BIO_CB_RETURN) && argl == 0)) {
if(WSAGetLastError() == WSAEWOULDBLOCK) if(wsa_err == WSAEWOULDBLOCK)
ub_winsock_tcp_wouldblock((struct ub_event*) ub_winsock_tcp_wouldblock((struct ub_event*)
BIO_get_callback_arg(b), UB_EV_WRITE); BIO_get_callback_arg(b), UB_EV_WRITE);
} }