Call less syscalls after each accept()
This commit is contained in:
@@ -79,8 +79,6 @@ static void incoming_handler(struct peer *peer) {
|
|||||||
local_hbuf, local_sbuf,
|
local_hbuf, local_sbuf,
|
||||||
peer_hbuf, peer_sbuf);
|
peer_hbuf, peer_sbuf);
|
||||||
|
|
||||||
socket_connected_init(fd);
|
|
||||||
|
|
||||||
if (!incoming_hello(fd, incoming)) {
|
if (!incoming_hello(fd, incoming)) {
|
||||||
fprintf(stderr, "I %s: Error writing greeting\n", incoming->id);
|
fprintf(stderr, "I %s: Error writing greeting\n", incoming->id);
|
||||||
assert(!close(fd));
|
assert(!close(fd));
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ void socket_bound_init(int fd) {
|
|||||||
// Called by transport code; safe to assume that fd is a socket
|
// Called by transport code; safe to assume that fd is a socket
|
||||||
int qlen = 5;
|
int qlen = 5;
|
||||||
assert(!setsockopt(fd, SOL_TCP, TCP_FASTOPEN, &qlen, sizeof(qlen)));
|
assert(!setsockopt(fd, SOL_TCP, TCP_FASTOPEN, &qlen, sizeof(qlen)));
|
||||||
|
|
||||||
|
// These options are inherited through accept()
|
||||||
|
// Verified by flamingcow on kernel 4.2.0
|
||||||
|
socket_connected_init(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void socket_connected_init(int fd) {
|
void socket_connected_init(int fd) {
|
||||||
|
|||||||
Reference in New Issue
Block a user