Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Destroy the listen guards when $cv is signaled. This closes the incom…

…ing socket, so you won't have new connections arriving while the rest of the server flushes events and shuts down
  • Loading branch information...
commit 78f0dd10920d6c049429b116fb2e6e1161575840 1 parent eee3325
@lestrrat lestrrat authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/Twiggy/Server.pm
View
6 lib/Twiggy/Server.pm
@@ -527,7 +527,11 @@ sub run {
my $self = shift;
$self->register_service(@_);
- my $exit = $self->{exit_guard} = AE::cv;
+ my $exit = $self->{exit_guard} = AE::cv {
+ # Make sure that we are not listening on a socket anymore, while
+ # other events are being flushed
+ delete $self->{listen_guards};
+ };
$exit->begin;
my $w; $w = AE::signal QUIT => sub { $exit->end; undef $w };
Please sign in to comment.
Something went wrong with that request. Please try again.