]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Fix a subtle bug affecting multiple-socket handling in Plink. (Was
authorSimon Tatham <anakin@pobox.com>
Tue, 23 Jan 2001 10:19:17 +0000 (10:19 +0000)
committerSimon Tatham <anakin@pobox.com>
Tue, 23 Jan 2001 10:19:17 +0000 (10:19 +0000)
interfering with X forwarding.)
Details of bug: the event object used as the target of
WSAEventSelect is created in such a way that it is automatically
reset when it releases a thread from WaitFor*Objects. Subsequently,
a read on the first socket in the list causes another network event
if not all the available data was read; thus the event object is set
again. Then, WSAEnumNetworkEvents is called again for the _second_
socket, and is passed the network event, which it therefore resets.
So an event has been dropped, and things only get restarted when
some more data arrives on the first socket.

[originally from svn r888]

plink.c

diff --git a/plink.c b/plink.c
index 16a44b38a1635b6f6cf0a15b829eb34b7a3436c8..61552fac1999010b208b548c56cb373f469e146c 100644 (file)
--- a/plink.c
+++ b/plink.c
@@ -557,7 +557,7 @@ int main(int argc, char **argv) {
                 WPARAM wp;
                 socket = sklist[i];
                 wp = (WPARAM)socket;
-               if (!WSAEnumNetworkEvents(socket, netevent, &things)) {
+               if (!WSAEnumNetworkEvents(socket, NULL, &things)) {
                     noise_ultralight(socket);
                     noise_ultralight(things.lNetworkEvents);
                    if (things.lNetworkEvents & FD_READ)