Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

move socket listen to start_listen, and let SS override that method i…

…nstead of register_service
  • Loading branch information...
commit c162a319e4092db8aba03ace5b23b712c0c04ab9 1 parent d0b0904
@lestrrat lestrrat authored
Showing with 9 additions and 11 deletions.
  1. +8 −3 lib/Twiggy/Server.pm
  2. +1 −8 lib/Twiggy/Server/SS.pm
View
11 lib/Twiggy/Server.pm
@@ -39,13 +39,18 @@ sub new {
}, $class;
}
-sub register_service {
- my($self, $app) = @_;
-
+sub start_listen {
+ my ($self, $app) = @_;
my @listen = @{$self->{listen} || [ ($self->{host} || '') . ":$self->{port}" ]};
for my $listen (@listen) {
push @{$self->{listen_guards}}, $self->_create_tcp_server($listen, $app);
}
+}
+
+sub register_service {
+ my($self, $app) = @_;
+
+ $self->start_listen($app);
$self->{exit_guard} = AE::cv {
# Make sure that we are not listening on a socket anymore, while
View
9 lib/Twiggy/Server/SS.pm
@@ -7,7 +7,7 @@ use AnyEvent::Util qw(fh_nonblocking guard);
use AnyEvent::Socket qw(format_address);
use Server::Starter qw(server_ports);
-sub register_service {
+sub start_listen {
my ($self, $app) = @_;
if (Twiggy::Server::DEBUG() && $self->{listen}) {
@@ -25,13 +25,6 @@ sub register_service {
# overwrite, just in case somebody wants to refer to it afterwards
$self->{listen} = \@listen;
-
- $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};
- };
- $self->{exit_guard}->begin;
}
sub _create_ss_tcp_server {
Please sign in to comment.
Something went wrong with that request. Please try again.