Ticket #12068: 0001-Stop-spuriously-setting-startup-flag-when-calling-do.patch

File 0001-Stop-spuriously-setting-startup-flag-when-calling-do.patch, 1.4 KB (added by Tobias Giesen, 8 months ago)

Patch from the PuTTY Project

  • windows/winnet.c

    From bc0506cbc69b87f4bd5c4d448b136ac80388c3ea Mon Sep 17 00:00:00 2001
    From: Simon Tatham <anakin@pobox.com>
    Date: Sat, 21 Dec 2019 13:31:02 +0000
    Subject: [PATCH] Stop spuriously setting 'startup' flag when calling
     do_select().
    
    Tobias Giesen reports that using PSFTP to download a large file caused
    many Windows event objects to be created. It looks as if the reason is
    because do_select() in winsftp.c creates the persistent 'netevent'
    object (for use with WSAEventSelect) if its 'startup' parameter is
    true; hence, that flag should only be set when the SSH socket is
    initially created. But in fact it was being set to true during routine
    operations _during_ the lifetime of the socket, namely freezing and
    unfreezing.
    ---
     windows/winnet.c | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/windows/winnet.c b/windows/winnet.c
    index ab38e547..36d79ebf 100644
    a b static void sk_net_set_frozen(Socket *sock, bool is_frozen)  
    17521752        return;
    17531753    s->frozen = is_frozen;
    17541754    if (!is_frozen) {
    1755         do_select(s->s, true);
     1755        do_select(s->s, false);
    17561756        if (s->frozen_readable) {
    17571757            char c;
    17581758            p_recv(s->s, &c, 1, MSG_PEEK);
    void socket_reselect_all(void)  
    17681768
    17691769    for (i = 0; (s = index234(sktree, i)) != NULL; i++) {
    17701770        if (!s->frozen)
    1771             do_select(s->s, true);
     1771            do_select(s->s, false);
    17721772    }
    17731773}
    17741774