Browse Source

handle EINPROGRESS nicely

pull/164/head
Max Lv 10 years ago
parent
commit
e9f2369486
1 changed files with 4 additions and 1 deletions
  1. 5
      src/server.c

5
src/server.c

@ -230,11 +230,14 @@ static struct remote *connect_to_remote(struct addrinfo *res,
server->buf_len, MSG_FASTOPEN, res->ai_addr,
res->ai_addrlen);
if (s == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
if (errno == EINPROGRESS || errno == EAGAIN
|| errno == EWOULDBLOCK) {
// The remote server doesn't support tfo or it's the first connection to the server.
// It will automatically fall back to conventional TCP.
} else if (errno == EOPNOTSUPP || errno == EPROTONOSUPPORT ||
errno == ENOPROTOOPT) {
// Disable fast open as it's not supported
fast_open = false;
LOGE("fast open is not supported on this platform");
connect(sockfd, res->ai_addr, res->ai_addrlen);
} else {

Loading…
Cancel
Save