Skip to content

Commit

Permalink
tcp_defer_accept option support for FreeBSD. (#4049)
Browse files Browse the repository at this point in the history
SO_ACCEPTFILER acts similarly as Linux's TCP_DEFER_ACCEPT.
  • Loading branch information
devnexen authored Mar 11, 2021
1 parent 91704ac commit 02126e8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/server/port.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,17 @@ int ListenPort::listen() {
}
#endif

#ifdef SO_ACCEPTFILTER
if (tcp_defer_accept) {
struct accept_filter_arg a;
memset(&a, 0, sizeof(a));
strcpy(a.af_name, "httpready");
if (socket->set_option(SOL_SOCKET, SO_ACCEPTFILTER, &a, sizeof(a)) != 0) {
swSysWarn("setsockopt(SO_ACCEPTFILTER) failed");
}
}
#endif

#ifdef TCP_FASTOPEN
if (tcp_fastopen) {
if (socket->set_option(IPPROTO_TCP, TCP_FASTOPEN, tcp_fastopen) != 0) {
Expand Down

0 comments on commit 02126e8

Please sign in to comment.