]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix windows tcp and tls spin on events.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 28 May 2018 12:30:34 +0000 (12:30 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 28 May 2018 12:30:34 +0000 (12:30 +0000)
git-svn-id: file:///svn/unbound/trunk@4696 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
util/netevent.c

index ab71c48e36bfbb016df165292a2b7970d207648e..84e3fac6dc6f070b82044fe47a0aad72e96030ca 100644 (file)
@@ -1,3 +1,6 @@
+28 May 2018: Wouter
+       - Fix windows tcp and tls spin on events.
+
 25 May 2018: Wouter
        - For TCP and TLS connections that don't establish, perform address
          update in infra cache, so future selections can exclude them.
index f90179e75245bd3cffae394e584a373ffafe0027..5cc8606fad3e66e10e9820d1b2231f746e8856aa 100644 (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),
         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,
                (oper&BIO_CB_RETURN)?"return":"before",
                (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 */
        if( (oper == (BIO_CB_READ|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*)
                                BIO_get_callback_arg(b), UB_EV_READ);
        }
        if( (oper == (BIO_CB_WRITE|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*)
                                BIO_get_callback_arg(b), UB_EV_WRITE);
        }