Browse Source

Also refine TCP fastopen

pull/472/head
crvv 9 years ago
parent
commit
d0cd1b427b
2 changed files with 5 additions and 8 deletions
  1. 11
      src/local.c
  2. 2
      src/server.c

11
src/local.c

@ -301,14 +301,11 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents)
endpoints.sae_dstaddr = (struct sockaddr*)&(remote->addr);
endpoints.sae_dstaddrlen = remote->addr_len;
struct iovec iov;
iov.iov_base = remote->buf->array;
iov.iov_len = remote->buf->len;
size_t len;
int s = connectx(remote->fd, &endpoints, SAE_ASSOCID_ANY, CONNECT_DATA_IDEMPOTENT,
&iov, 1, &len, NULL);
int s = connectx(remote->fd, &endpoints, SAE_ASSOCID_ANY,
CONNECT_RESUME_ON_READ_WRITE | CONNECT_DATA_IDEMPOTENT,
NULL, 0, NULL, NULL);
if (s == 0) {
s = len;
s = send(remote->fd, remote->buf->array, remote->buf->len, 0);
}
#else
int s = sendto(remote->fd, remote->buf->array, remote->buf->len, MSG_FASTOPEN,

2
src/server.c

@ -446,7 +446,7 @@ static remote_t *connect_to_remote(struct addrinfo *res,
} else {
ERROR("sendto");
}
} else if (s < server->buf->len) {
} else if (s <= server->buf->len) {
server->buf->idx += s;
server->buf->len -= s;
} else {

Loading…
Cancel
Save