diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2023-11-07 13:42:45 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-11-07 09:54:06 +0100 |
commit | 0e8e53485073273fffd8ea52534182844b69737b (patch) | |
tree | 43880274ec877175adf0a579e08cec85745d5512 /log.h | |
parent | 6357010cab9bafeb1069866b5879ea4a11d3e60b (diff) | |
download | passt-0e8e53485073273fffd8ea52534182844b69737b.tar passt-0e8e53485073273fffd8ea52534182844b69737b.tar.gz passt-0e8e53485073273fffd8ea52534182844b69737b.tar.bz2 passt-0e8e53485073273fffd8ea52534182844b69737b.tar.lz passt-0e8e53485073273fffd8ea52534182844b69737b.tar.xz passt-0e8e53485073273fffd8ea52534182844b69737b.tar.zst passt-0e8e53485073273fffd8ea52534182844b69737b.zip |
tcp_splice: Don't pool pipes in pairs
To reduce latencies, the tcp splice code maintains a pool of pre-opened
pipes to use for new connections. This is structured as an array of pairs
of pipes, with each pipe, of course, being a pair of fds. Thus when we
use the pool, a single pool "slot" provides both the a->b and b->a pipes.
There's no strong reason to store the pool in pairs, though - we can
with not much difficulty instead take the a->b and b->a pipes for a new
connection independently from separate slots in the pool, or even take one
from the the pool and create the other as we need it, if there's only one
pipe left in the pool.
This marginally increases the length of code, but simplifies the structure
of the pipe pool. We should be able to re-shrink the code with later
changes, too.
In the process we also fix some minor bugs:
- If we both failed to find a pipe in the pool and to create a new one, we
didn't log an error and would silently drop the connection. That could
make debugging such a situation difficult. Add in an error message for
that case
- When refilling the pool, if we were only able to open a single pipe in
the pair, we attempted to rollback, but instead of closing the opened
pipe, we instead closed the pipe we failed to open (probably leading to
some ignored EBADFD errors).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'log.h')
0 files changed, 0 insertions, 0 deletions