Skip to content
This repository

SS seems to work well with unix sockets, not sure why it is specifically not supported #29

Open
wants to merge 1 commit into from

1 participant

مارون
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Apr 30, 2012
مارون c0decafe support unix sockets in Twiggy::Server::SS f289a55
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 13 additions and 13 deletions. Show diff stats Hide diff stats

  1. +13 13 lib/Twiggy/Server/SS.pm
26 lib/Twiggy/Server/SS.pm
@@ -18,9 +18,9 @@ sub start_listen {
18 18
19 19 my @listen;
20 20 my $ports = server_ports();
21   - while (my ($hostport, $fd) = each %$ports ) {
22   - push @listen, $hostport;
23   - $self->_create_ss_tcp_server($hostport, $fd, $app);
  21 + while (my ($listen, $fd) = each %$ports ) {
  22 + push @listen, $listen;
  23 + $self->_create_ss_tcp_server($listen, $fd, $app);
24 24 }
25 25
26 26 # overwrite, just in case somebody wants to refer to it afterwards
@@ -28,17 +28,17 @@ sub start_listen {
28 28 }
29 29
30 30 sub _create_ss_tcp_server {
31   - my ($self, $hostport, $fd, $app) = @_;
32   -
33   - my $is_tcp = 1; # currently no unix socket support
34   -
35   - my ($host, $port);
36   - if ($hostport =~ /(.*):(\d+)/) {
37   - $host = $1;
38   - $port = $2;
  31 + my ($self, $listen, $fd, $app) = @_;
  32 +
  33 + my($host, $port, $is_tcp);
  34 + if ($listen =~ /:\d+$/) {
  35 + ($host, $port) = split /:/, $listen;
  36 + $host = undef if $host eq '';
  37 + $port = undef if $port == 0;
  38 + $is_tcp = 1;
39 39 } else {
40   - $host ||= '0.0.0.0';
41   - $port = $hostport;
  40 + $host = "unix/";
  41 + $port = $listen;
42 42 }
43 43
44 44 # /WE/ don't care what the address family, type of socket we got, just

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.