This commit is contained in:
Ihar Hrachyshka 2026-11-21 00:14:40 -05:00 • committed by GitHub
commit fe5bce057f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View file

@ -409,7 +409,9 @@ int ncat_listen()
init_fdlist(&broadcast_fdlist, o.conn_limit);
while (!breakloop && (client_fdlist.nfds > 1 || get_conn_count() > 0)) {
/* Receive-only mode does not add stdin to the descriptor list. */
while (!breakloop && (client_fdlist.nfds > (o.recvonly ? 0 : 1)
|| get_conn_count() > 0)) {
long usec_wait = -1;
tvp = NULL;
/* We pass these temporary descriptor sets to fselect, since fselect

View file

@ -1075,6 +1075,20 @@ server_client_test_tcp_sctp_ssl "--recv-only server closes stdout and stops runn
["--recv-only"], [], eof_test("Server", 1, "socket");
kill_children;
# Receive-only listeners must work with either address family on its own.
for my $binding (["-4", "IPv4"], ["-6", "IPv6"]) {
my ($family, $description) = @$binding;
server_client_test_tcp_ssl "--recv-only server receives data over $description",
["--recv-only", $family], [$family, "--send-only"], sub {
syswrite($c_in, "abc\n");
close($c_in);
my $resp = timeout_read($s_out) or die "Read timeout";
$resp eq "abc\n" or die "Server got " . d($resp);
};
}
# Tests to check that server defaults to non-persistent without --keep-open.
# Server immediately quits after the first connection closed without --keep-open