Created
April 30, 2012 07:55
-
-
Save anonymous/2556372 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ru perl/lib/perl5/Twiggy/Server/SS.pm Twiggy/lib/Twiggy/Server/SS.pm | |
--- perl/lib/perl5/Twiggy/Server/SS.pm 2012-04-30 08:24:53.554001546 +0300 | |
+++ Twiggy/lib/Twiggy/Server/SS.pm 2012-04-30 07:49:43.440260764 +0300 | |
@@ -18,9 +18,9 @@ | |
my @listen; | |
my $ports = server_ports(); | |
- while (my ($listen, $fd) = each %$ports ) { | |
- push @listen, $listen; | |
- $self->_create_ss_tcp_server($listen, $fd, $app); | |
+ while (my ($hostport, $fd) = each %$ports ) { | |
+ push @listen, $hostport; | |
+ $self->_create_ss_tcp_server($hostport, $fd, $app); | |
} | |
# overwrite, just in case somebody wants to refer to it afterwards | |
@@ -28,17 +28,17 @@ | |
} | |
sub _create_ss_tcp_server { | |
- my ($self, $listen, $fd, $app) = @_; | |
+ my ($self, $hostport, $fd, $app) = @_; | |
- my($host, $port, $is_tcp); | |
- if ($listen =~ /:\d+$/) { | |
- ($host, $port) = split /:/, $listen; | |
- $host = undef if $host eq ''; | |
- $port = undef if $port == 0; | |
- $is_tcp = 1; | |
+ my $is_tcp = 1; # currently no unix socket support | |
+ | |
+ my ($host, $port); | |
+ if ($hostport =~ /(.*):(\d+)/) { | |
+ $host = $1; | |
+ $port = $2; | |
} else { | |
- $host = "unix/"; | |
- $port = $listen; | |
+ $host ||= '0.0.0.0'; | |
+ $port = $hostport; | |
} | |
# /WE/ don't care what the address family, type of socket we got, just |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment