Skip to content

Commit

Permalink
恢复被误删的代码
Browse files Browse the repository at this point in the history
  • Loading branch information
breath-co2 committed May 4, 2017
1 parent 977b224 commit 334d278
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -1483,8 +1483,15 @@ protected function parseSockUri($uri)
{
$result = new \stdClass();
$p = parse_url($uri);
if (false === $p && substr($uri, 0, 8) == 'unix:///')
{
$p = [
'scheme' => 'unix',
'path' => substr($uri, 7),
];
}

if ($p)
if (false !== $p)
{
switch ($scheme = strtolower($p['scheme']))
{
Expand Down Expand Up @@ -1514,10 +1521,24 @@ protected function parseSockUri($uri)
$result->port = $p['port'];
break;

case 'udp':
$result->scheme = $scheme;
$result->type = SWOOLE_SOCK_UDP;
$result->host = $p['host'];
$result->port = $p['port'];
break;

case 'udp6':
$result->scheme = $scheme;
$result->type = SWOOLE_SOCK_UDP6;
$result->host = $p['host'];
$result->port = $p['port'];
break;

case 'unix':
$result->scheme = $scheme;
$result->type = SWOOLE_UNIX_STREAM;
$result->host = $p['path'];
$result->host = (isset($p['host']) ? '/'.$p['host']:''). $p['path'];
$result->port = 0;
break;

Expand All @@ -1527,7 +1548,7 @@ protected function parseSockUri($uri)
}
else
{
throw new \Exception("Can't parse this uri: " . $uri);
throw new \Exception("Can't parse this Uri: " . $uri);
}

return $result;
Expand Down

0 comments on commit 334d278

Please sign in to comment.