Skip to content

Commit

Permalink
use udpfw for rebind tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuho committed Apr 23, 2024
1 parent 8da806f commit a62d92f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
9 changes: 0 additions & 9 deletions src/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,6 @@ static int run_client(int fd, struct sockaddr *sa, const char *host)
int ret;
quicly_conn_t *conn = NULL;

signal(SIGUSR1, on_client_signal);
signal(SIGTERM, on_client_signal);

memset(&local, 0, sizeof(local));
Expand All @@ -784,14 +783,6 @@ static int run_client(int fd, struct sockaddr *sa, const char *host)
fd_set readfds;
struct timeval *tv, tvbuf;
do {
if (client_gotsig == SIGUSR1) {
client_gotsig = 0;
int newfd = new_socket(local.sa.sa_family);
if (newfd != -1) {
close(fd);
fd = newfd;
}
}
int64_t timeout_at = conn != NULL ? quicly_get_first_timeout(conn) : INT64_MAX;
if (enqueue_requests_at < timeout_at)
timeout_at = enqueue_requests_at;
Expand Down
19 changes: 14 additions & 5 deletions t/e2e.t
Original file line number Diff line number Diff line change
Expand Up @@ -355,25 +355,34 @@ subtest "raw-certificates-ec" => sub {
subtest "path-migration" => sub {
my $doit = sub {
my @client_opts = @_;
my $guard = spawn_server("-e", "$tempdir/events");
my $server_guard = spawn_server("-e", "$tempdir/events");
my $udpfw_guard = undef;
my $respawn_udpfw = sub {
$udpfw_guard = undef; # terminate existing process
$udpfw_guard = spawn_process(
["sh", "-c", "exec $udpfw -b 100 -i 1 -p 0 -B 100 -I 1 -P 10000 -l $udpfw_port 127.0.0.1 $port > /dev/null 2>&1"],
$udpfw_port,
);
};
$respawn_udpfw->();
# spawn client that sends one request every second, recording events to file
my $pid = fork;
die "fork failed:$!"
unless defined $pid;
if ($pid == 0) {
exec $cli, @client_opts, qw(-O -i 1000 -p /10000 127.0.0.1), $port;
exec $cli, @client_opts, qw(-O -i 1000 -p /10000 127.0.0.1), $udpfw_port;
die "exec $cli failed:$!";
}
# send two USR1 signals, each of them causing path migration between requests
sleep .5;
kill 'USR1', $pid;
$respawn_udpfw->();
sleep 2;
kill 'USR1', $pid;
$respawn_udpfw->();
sleep 2;
# kill the peers
kill 'TERM', $pid;
while (waitpid($pid, 0) != $pid) {}
my $server_output = $guard->finalize;
my $server_output = $server_guard->finalize;
# read the log
my $log = slurp_file("$tempdir/events");
# check that the path has migrated twice
Expand Down

0 comments on commit a62d92f

Please sign in to comment.