mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 09:12:24 +00:00
The remaining issue in `win-askappend-multi' appears to have been
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.)
[originally from svn r7077]
[r7071 == 57a763b0ec
]
This commit is contained in:
parent
bacbc03f9f
commit
6c3f4b3baa
@ -843,6 +843,7 @@ int askalg(void *frontend, const char *algtype, const char *algname,
|
|||||||
title = dupprintf(mbtitle, appname);
|
title = dupprintf(mbtitle, appname);
|
||||||
mbret = MessageBox(NULL, message, title,
|
mbret = MessageBox(NULL, message, title,
|
||||||
MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
|
MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
|
||||||
|
socket_reselect_all();
|
||||||
sfree(message);
|
sfree(message);
|
||||||
sfree(title);
|
sfree(title);
|
||||||
if (mbret == IDYES)
|
if (mbret == IDYES)
|
||||||
@ -875,6 +876,8 @@ int askappend(void *frontend, Filename filename,
|
|||||||
mbret = MessageBox(NULL, message, mbtitle,
|
mbret = MessageBox(NULL, message, mbtitle,
|
||||||
MB_ICONQUESTION | MB_YESNOCANCEL | MB_DEFBUTTON3);
|
MB_ICONQUESTION | MB_YESNOCANCEL | MB_DEFBUTTON3);
|
||||||
|
|
||||||
|
socket_reselect_all();
|
||||||
|
|
||||||
sfree(message);
|
sfree(message);
|
||||||
sfree(mbtitle);
|
sfree(mbtitle);
|
||||||
|
|
||||||
@ -916,6 +919,8 @@ void old_keyfile_warning(void)
|
|||||||
|
|
||||||
MessageBox(NULL, msg, title, MB_OK);
|
MessageBox(NULL, msg, title, MB_OK);
|
||||||
|
|
||||||
|
socket_reselect_all();
|
||||||
|
|
||||||
sfree(msg);
|
sfree(msg);
|
||||||
sfree(title);
|
sfree(title);
|
||||||
}
|
}
|
||||||
|
@ -1473,10 +1473,11 @@ int select_result(WPARAM wParam, LPARAM lParam)
|
|||||||
#ifndef NO_IPV6
|
#ifndef NO_IPV6
|
||||||
if (isa.ss_family == AF_INET &&
|
if (isa.ss_family == AF_INET &&
|
||||||
s->localhost_only &&
|
s->localhost_only &&
|
||||||
!ipv4_is_local_addr(((struct sockaddr_in *)&isa)->sin_addr)) {
|
!ipv4_is_local_addr(((struct sockaddr_in *)&isa)->sin_addr))
|
||||||
#else
|
#else
|
||||||
if (s->localhost_only && !ipv4_is_local_addr(isa.sin_addr)) {
|
if (s->localhost_only && !ipv4_is_local_addr(isa.sin_addr))
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
p_closesocket(t); /* dodgy WinSock let nonlocal through */
|
p_closesocket(t); /* dodgy WinSock let nonlocal through */
|
||||||
} else if (plug_accepting(s->plug, (void*)t)) {
|
} else if (plug_accepting(s->plug, (void*)t)) {
|
||||||
p_closesocket(t); /* denied or error */
|
p_closesocket(t); /* denied or error */
|
||||||
@ -1572,6 +1573,17 @@ static void sk_tcp_set_frozen(Socket sock, int is_frozen)
|
|||||||
s->frozen_readable = 0;
|
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.
|
* For Plink: enumerate all sockets currently active.
|
||||||
*/
|
*/
|
||||||
|
@ -202,6 +202,8 @@ extern int (WINAPI *p_WSAEnumNetworkEvents)
|
|||||||
|
|
||||||
extern int socket_writable(SOCKET skt);
|
extern int socket_writable(SOCKET skt);
|
||||||
|
|
||||||
|
extern void socket_reselect_all(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exports from winctrls.c.
|
* Exports from winctrls.c.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user