Refine TCP fastopen

This commit is contained in:
Max Lv
2015-12-07 12:47:28 +08:00
parent 4656a8f0b9
commit e7a1d1e333
2 changed files with 7 additions and 4 deletions
+5 -1
View File
@@ -250,7 +250,11 @@ int setfastopen(int fd)
int s = 0;
#ifdef TCP_FASTOPEN
if (fast_open) {
#ifdef __APPLE__
int opt = 1;
#else
int opt = 5;
#endif
s = setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN, &opt, sizeof(opt));
if (s == -1) {
if (errno == EPROTONOSUPPORT || errno == ENOPROTOOPT) {
@@ -760,7 +764,7 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents)
server->stage = 4;
// listen to remote connected event
// waiting on remote connected event
ev_io_stop(EV_A_ & server_recv_ctx->io);
ev_io_start(EV_A_ & remote->send_ctx->io);
}