diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-30 15:23:55 +0100 |
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-30 15:23:55 +0100 |
| commit | b306c5cbf152da9d8cbd81ba1ea8c8813af197a9 (patch) | |
| tree | 74e629874bcf7f7989a2117acfd52222c6f85421 | |
| parent | 31d2586e3296d424e51848ada963299b0da89324 (diff) | |
Use accept filter dataready instead of httpready on FreeBSD
| -rw-r--r-- | man4/opentracker.conf.4 | 11 | ||||
| -rw-r--r-- | ot_socket.c | 3 |
2 files changed, 13 insertions, 1 deletions
diff --git a/man4/opentracker.conf.4 b/man4/opentracker.conf.4 index b28879f..aa82e1d 100644 --- a/man4/opentracker.conf.4 +++ b/man4/opentracker.conf.4 | |||
| @@ -100,6 +100,17 @@ group only where the answer is yes. | |||
| 100 | .Pa tests/udp_scaling.py | 100 | .Pa tests/udp_scaling.py |
| 101 | in the source distribution sweeps the setting against a running tracker. | 101 | in the source distribution sweeps the setting against a running tracker. |
| 102 | Measure on the machine that will carry the traffic. | 102 | Measure on the machine that will carry the traffic. |
| 103 | .Pp | ||
| 104 | On FreeBSD the | ||
| 105 | .Xr accf_data 9 | ||
| 106 | filter has the kernel hold a new connection until data arrives on it, so the | ||
| 107 | tracker is woken once with the request already there. opentracker uses it | ||
| 108 | wherever it is available; enable it with | ||
| 109 | .Cm options ACCEPT_FILTER_DATA | ||
| 110 | in the kernel or | ||
| 111 | .Va kld_list Ns = Ns Qq accf_data | ||
| 112 | in | ||
| 113 | .Xr rc.conf 5 . | ||
| 103 | .Sh EXAMPLES | 114 | .Sh EXAMPLES |
| 104 | To specify the address opentracker will listen on for both TCP and UDP connections: | 115 | To specify the address opentracker will listen on for both TCP and UDP connections: |
| 105 | .Dl listen.tcp_udp 0.0.0.0:6969 | 116 | .Dl listen.tcp_udp 0.0.0.0:6969 |
diff --git a/ot_socket.c b/ot_socket.c index 78a16d2..48ffc27 100644 --- a/ot_socket.c +++ b/ot_socket.c | |||
| @@ -130,9 +130,10 @@ int socket_defer_accept(int s) { | |||
| 130 | return setsockopt(s, IPPROTO_TCP, TCP_DEFER_ACCEPT, &patience, sizeof(patience)); | 130 | return setsockopt(s, IPPROTO_TCP, TCP_DEFER_ACCEPT, &patience, sizeof(patience)); |
| 131 | #elif defined(SO_ACCEPTFILTER) | 131 | #elif defined(SO_ACCEPTFILTER) |
| 132 | struct accept_filter_arg filter; | 132 | struct accept_filter_arg filter; |
| 133 | const char name[sizeof(filter.af_name)] = "dataready"; | ||
| 133 | 134 | ||
| 134 | memset(&filter, 0, sizeof(filter)); | 135 | memset(&filter, 0, sizeof(filter)); |
| 135 | strcpy(filter.af_name, "httpready"); | 136 | memcpy(filter.af_name, name, sizeof(name)); |
| 136 | return setsockopt(s, SOL_SOCKET, SO_ACCEPTFILTER, &filter, sizeof(filter)); | 137 | return setsockopt(s, SOL_SOCKET, SO_ACCEPTFILTER, &filter, sizeof(filter)); |
| 137 | #else | 138 | #else |
| 138 | (void)s; | 139 | (void)s; |
