Working TCP fastopen for connect-send.

This commit is contained in:
Ian Gulliver
2016-02-27 12:41:56 -08:00
parent 79fc645fa0
commit 2c5b6419d6
7 changed files with 51 additions and 32 deletions

View File

@@ -20,13 +20,13 @@ static char *opts_split(char **arg, char delim) {
return ret;
}
static void opts_add_listen(char *host_port, incoming_connection_handler handler, void *passthrough, uint32_t *count) {
static void opts_add_listen(char *host_port, incoming_connection_handler handler, incoming_get_hello hello, void *passthrough, uint32_t *count) {
char *host = opts_split(&host_port, '/');
if (host) {
incoming_new(host, host_port, handler, passthrough, count);
incoming_new(host, host_port, handler, hello, passthrough, count);
free(host);
} else {
incoming_new(NULL, host_port, handler, passthrough, count);
incoming_new(NULL, host_port, handler, hello, passthrough, count);
}
}
@@ -51,7 +51,7 @@ bool opts_add_connect_receive(char *arg) {
return false;
}
outgoing_new(host, arg, receive_new, NULL, &peer_count_in);
outgoing_new(host, arg, receive_new, NULL, NULL, &peer_count_in);
free(host);
return true;
}
@@ -67,13 +67,13 @@ bool opts_add_connect_send(char *arg) {
return false;
}
outgoing_new(host, arg, send_new_wrapper, serializer, &peer_count_out);
outgoing_new(host, arg, send_new_wrapper, send_hello, serializer, &peer_count_out);
free(host);
return true;
}
bool opts_add_listen_receive(char *arg) {
opts_add_listen(arg, receive_new, NULL, &peer_count_in);
opts_add_listen(arg, receive_new, NULL, NULL, &peer_count_in);
return true;
}
@@ -83,7 +83,7 @@ bool opts_add_listen_send(char *arg) {
return false;
}
opts_add_listen(arg, send_new_wrapper, serializer, &peer_count_out);
opts_add_listen(arg, send_new_wrapper, send_hello, serializer, &peer_count_out);
return true;
}