0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 7.4.1263

Problem:    ch_open() hangs when the server isn't running.
Solution:   Add a timeout. Use a dict to pass arguments. (Yasuhiro Matsumoto)
This commit is contained in:
Bram Moolenaar
2016-02-05 22:36:41 +01:00
parent a07fec9c85
commit 4d919d748e
9 changed files with 289 additions and 116 deletions

View File

@@ -1123,6 +1123,29 @@ mch_setmouse(int on)
SetConsoleMode(g_hConIn, cmodein);
}
#ifdef FEAT_CHANNEL
static int
handle_channel_event(void)
{
int ret;
fd_set rfds;
int maxfd;
FD_ZERO(&rfds);
maxfd = channel_select_setup(-1, &rfds);
if (maxfd >= 0)
{
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 0;
ret = select(maxfd + 1, &rfds, NULL, NULL, &tv);
if (ret > 0 && channel_select_check(ret, &rfds) > 0)
return TRUE;
}
return FALSE;
}
#endif
/*
* Decode a MOUSE_EVENT. If it's a valid event, return MOUSE_LEFT,
@@ -1443,11 +1466,6 @@ WaitForChar(long msec)
INPUT_RECORD ir;
DWORD cRecords;
WCHAR ch, ch2;
#ifdef FEAT_CHANNEL
int ret;
fd_set rfds;
int maxfd;
#endif
if (msec > 0)
/* Wait until the specified time has elapsed. */
@@ -1472,18 +1490,8 @@ WaitForChar(long msec)
#endif
#ifdef FEAT_CHANNEL
FD_ZERO(&rfds);
maxfd = channel_select_setup(-1, &rfds);
if (maxfd >= 0)
{
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 0;
ret = select(maxfd + 1, &rfds, NULL, NULL, &tv);
if (ret > 0 && channel_select_check(ret, &rfds) > 0)
return TRUE;
}
if (handle_channel_event())
return TRUE;
#endif
if (0