mirror of
https://github.com/neovim/neovim.git
synced 2025-12-06 06:32:33 +00:00
fix(remote): remote-ui connect timeout on slow networks #36800
Problem:
Connecting to a remote Neovim fails on slow network:
```
$ nvim --remote-ui --server 10.0.3.100:11111
Remote ui failed to start: connection refused
```
Strace reveals that the connection wasn't actually refused, but was still in progress:
```
15:52:50.678223 socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 11
15:52:50.678278 setsockopt(11, SOL_TCP, TCP_NODELAY, [1], 4) = 0
15:52:50.678320 connect(11, {sa_family=AF_INET, sin_port=htons(11111), sin_addr=inet_addr("10.0.3.100")}, 16) = -1 EINPROGRESS (Дія зараз виконується)
15:52:50.678443 clock_gettime(CLOCK_MONOTONIC, {tv_sec=21736, tv_nsec=57625406}) = 0
15:52:50.678489 io_uring_enter(4, 3, 3, IORING_ENTER_GETEVENTS, NULL, 0) = 3
15:52:50.678544 epoll_pwait(3, [], 1024, 50, NULL, 8) = 0
15:52:50.728911 clock_gettime(CLOCK_MONOTONIC, {tv_sec=21736, tv_nsec=108159596}) = 0
15:52:50.729203 epoll_ctl(3, EPOLL_CTL_DEL, 11, 0x7ffd6ec9a3bc) = 0
15:52:50.729527 close(11) = 0
```
Solution:
Increase hardcoded timeout from 50ms to 500ms.
(cherry picked from commit a141fd2c4d)
This commit is contained in:
committed by
github-actions[bot]
parent
b3eab00e55
commit
5ca2eb5e48
@@ -909,7 +909,7 @@ static uint64_t server_connect(char *server_addr, const char **errmsg)
|
||||
const char *error = NULL;
|
||||
bool is_tcp = strrchr(server_addr, ':') ? true : false;
|
||||
// connected to channel
|
||||
uint64_t chan = channel_connect(is_tcp, server_addr, true, on_data, 50, &error);
|
||||
uint64_t chan = channel_connect(is_tcp, server_addr, true, on_data, 500, &error);
|
||||
if (error) {
|
||||
*errmsg = error;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user