]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Add error variable to loop condition
authorTim Kosse <tim.kosse@filezilla-project.org>
Mon, 23 Jan 2017 17:51:03 +0000 (18:51 +0100)
committerSimon Tatham <anakin@pobox.com>
Sat, 28 Jan 2017 14:03:09 +0000 (14:03 +0000)
In case of connection errors before and during the handshake,
net_select_result is retrying with the next address of the server. It
however was immediately going to the last address as it was not
checking the return value of try_connect for all intermediate
addresses.

unix/uxnet.c
windows/winnet.c

index 730f1fa7d5024d3e0dd6d0e28a064005cd045ac4..75f809d2b8d0015e1652859fde7486ff7c8ce8bb 100644 (file)
@@ -1351,7 +1351,7 @@ static int net_select_result(int fd, int event)
             int err = errno;
            if (s->addr) {
                plug_log(s->plug, 1, s->addr, s->port, strerror(err), err);
-               while (s->addr && sk_nextaddr(s->addr, &s->step)) {
+               while (err && s->addr && sk_nextaddr(s->addr, &s->step)) {
                    err = try_connect(s);
                }
            }
index b4264def43d367a8bec58ef19be051e5aa16470a..72360639e7c49cd770349a1d6388b3eb311c61d0 100644 (file)
@@ -1580,7 +1580,7 @@ int select_result(WPARAM wParam, LPARAM lParam)
        if (s->addr) {
            plug_log(s->plug, 1, s->addr, s->port,
                     winsock_error_string(err), err);
-           while (s->addr && sk_nextaddr(s->addr, &s->step)) {
+           while (err && s->addr && sk_nextaddr(s->addr, &s->step)) {
                err = try_connect(s);
            }
        }