caused by the MessageBox() internal message loop eating WinSock
FD_READ notifications, which then don't reappear afterwards because
you have to explicitly prod a socket in order to get a repeat
notification on it.
Hence, here's a piece of infrastructure which seems to sort it out:
a new winnet.c function called socket_reselect_all(), whose function
is to go through all currently active sockets and re-run
WSAAsyncSelect() on them, causing repeat notifications for anything
we might have missed. I call this after every call to MessageBox(),
and that seems to solve the problem.
(The problem was actually masked in very recent revisions, probably
by the reinstatement of pending_netevent in r7071. However, I don't
believe that was a complete fix. This should be.)
git-svn-id: svn://svn.tartarus.org/sgt/putty@7077
cda61777-01e9-0310-a592-
d414129be87e
title = dupprintf(mbtitle, appname);
mbret = MessageBox(NULL, message, title,
MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
+ socket_reselect_all();
sfree(message);
sfree(title);
if (mbret == IDYES)
mbret = MessageBox(NULL, message, mbtitle,
MB_ICONQUESTION | MB_YESNOCANCEL | MB_DEFBUTTON3);
+ socket_reselect_all();
+
sfree(message);
sfree(mbtitle);
MessageBox(NULL, msg, title, MB_OK);
+ socket_reselect_all();
+
sfree(msg);
sfree(title);
}
#ifndef NO_IPV6
if (isa.ss_family == AF_INET &&
s->localhost_only &&
- !ipv4_is_local_addr(((struct sockaddr_in *)&isa)->sin_addr)) {
+ !ipv4_is_local_addr(((struct sockaddr_in *)&isa)->sin_addr))
#else
- if (s->localhost_only && !ipv4_is_local_addr(isa.sin_addr)) {
+ if (s->localhost_only && !ipv4_is_local_addr(isa.sin_addr))
#endif
+ {
p_closesocket(t); /* dodgy WinSock let nonlocal through */
} else if (plug_accepting(s->plug, (void*)t)) {
p_closesocket(t); /* denied or error */
s->frozen_readable = 0;
}
+void socket_reselect_all(void)
+{
+ Actual_Socket s;
+ int i;
+
+ for (i = 0; (s = index234(sktree, i)) != NULL; i++) {
+ if (!s->frozen)
+ do_select(s->s, 1);
+ }
+}
+
/*
* For Plink: enumerate all sockets currently active.
*/
extern int socket_writable(SOCKET skt);
+extern void socket_reselect_all(void);
+
/*
* Exports from winctrls.c.
*/