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)
|
1752 | 1752 | return; |
1753 | 1753 | s->frozen = is_frozen; |
1754 | 1754 | if (!is_frozen) { |
1755 | | do_select(s->s, true); |
| 1755 | do_select(s->s, false); |
1756 | 1756 | if (s->frozen_readable) { |
1757 | 1757 | char c; |
1758 | 1758 | p_recv(s->s, &c, 1, MSG_PEEK); |
… |
… |
void socket_reselect_all(void)
|
1768 | 1768 | |
1769 | 1769 | for (i = 0; (s = index234(sktree, i)) != NULL; i++) { |
1770 | 1770 | if (!s->frozen) |
1771 | | do_select(s->s, true); |
| 1771 | do_select(s->s, false); |
1772 | 1772 | } |
1773 | 1773 | } |
1774 | 1774 | |