Browse Source

TCP Fast Open CONNECT_IN_PROGRESS

pull/2135/head
Jared Hillier 6 years ago
committed by GitHub
parent
commit
3ce2771c92
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 2 deletions
  1. 26
      src/tunnel.c

26
src/tunnel.c

@ -473,10 +473,32 @@ remote_send_cb(EV_P_ ev_io *w, int revents)
// has data to send
ssize_t s = -1;
if (remote->addr != NULL) {
#ifdef MSG_FASTOPEN
s = sendto(remote->fd, remote->buf->data + remote->buf->idx,
remote->buf->len, MSG_FASTOPEN, remote->addr,
get_sockaddr_len(remote->addr));
remote->buf->len, MSG_FASTOPEN, remote->addr,
get_sockaddr_len(remote->addr));
#endif
remote->addr = NULL;
if (s == -1) {
if (errno == CONNECT_IN_PROGRESS) {
ev_io_start(EV_A_ & remote_send_ctx->io);
ev_timer_start(EV_A_ & remote_send_ctx->watcher);
} else {
if (errno == EOPNOTSUPP || errno == EPROTONOSUPPORT ||
errno == ENOPROTOOPT) {
fast_open = 0;
LOGE("fast open is not supported on this platform");
} else {
ERROR("fast_open_connect");
}
close_and_free_remote(EV_A_ remote);
close_and_free_server(EV_A_ server);
}
return;
}
} else {
s = send(remote->fd, remote->buf->data + remote->buf->idx,
remote->buf->len, 0);

Loading…
Cancel
Save