mirror of https://github.com/OpenVPN/openvpn-gui
Avoid blocking calls during WM_OVPN_ECHOMSG processing
We send this message from the connection thread to the main thread using a blocking SendMesssage as the echo message to display is cleared soon after. This sometimes leads to timeouts (and thus long waits). Avoid timeout using Async ShowWindow() and delaying SetForegroundWindow() as these could otherwise wait if the current foreground Window is controlled by the calling thread. Signed-off-by: Selva Nair <selva.nair@gmail.com>pull/761/merge
parent
700fdd315f
commit
d5e57cf079
7
echo.c
7
echo.c
|
|
@ -292,6 +292,10 @@ echo_msg_display(connection_t *c, time_t timestamp, const char *title, int type)
|
||||||
{
|
{
|
||||||
WriteStatusLog(c, L"GUI> Failed to display echo message: ", c->echo_msg.title, false);
|
WriteStatusLog(c, L"GUI> Failed to display echo message: ", c->echo_msg.title, false);
|
||||||
}
|
}
|
||||||
|
else if (echo_msg_window)
|
||||||
|
{
|
||||||
|
SetForegroundWindow(echo_msg_window);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else /* notify */
|
else /* notify */
|
||||||
{
|
{
|
||||||
|
|
@ -610,8 +614,7 @@ MessageDialogFunc(HWND hwnd, UINT msg, UNUSED WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
AddMessageBoxText(hwnd, c->echo_msg.text, c->echo_msg.title, from);
|
AddMessageBoxText(hwnd, c->echo_msg.text, c->echo_msg.title, from);
|
||||||
SetForegroundWindow(hwnd);
|
ShowWindowAsync(hwnd, SW_SHOW);
|
||||||
ShowWindow(hwnd, SW_SHOW);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue