@@ -19,7 +19,7 @@  | 
                                                    ||
| 19 | 19 | */  | 
                                                        
| 20 | 20 | public static function viaTCP(int $port) : string  | 
                                                        
| 21 | 21 |      { | 
                                                        
| 22 | -        return Tags::CMD . sprintf('%s:%s::%d', Named::KEY, Named::TCP, $port); | 
                                                        |
| 22 | +        return Tags::CMD.sprintf('%s:%s::%d', Named::KEY, Named::TCP, $port); | 
                                                        |
| 23 | 23 | }  | 
                                                        
| 24 | 24 | |
| 25 | 25 | /**  | 
                                                        
@@ -116,9 +116,9 @@  | 
                                                    ||
| 116 | 116 | return;  | 
                                                        
| 117 | 117 | }  | 
                                                        
| 118 | 118 | |
| 119 | -        $this->reconcile->wait($idx = $this->seq())->message()->then(function (string $message) use ($seq, $socket) { | 
                                                        |
| 119 | +        $this->reconcile->wait($idx = $this->seq())->message()->then(function(string $message) use ($seq, $socket) { | 
                                                        |
| 120 | 120 | return $socket->write($this->packing($seq, $message));  | 
                                                        
| 121 | -        }, static function () use ($socket) { | 
                                                        |
| 121 | +        }, static function() use ($socket) { | 
                                                        |
| 122 | 122 | return $socket->close();  | 
                                                        
| 123 | 123 | });  | 
                                                        
| 124 | 124 | |
@@ -56,7 +56,7 @@  | 
                                                    ||
| 56 | 56 | $this->address = $address = new Address($endpoint->address()->host(), $endpoint->option(Named::VIA_TCP));  | 
                                                        
| 57 | 57 | $this->options = $options;  | 
                                                        
| 58 | 58 | |
| 59 | -        $this->sockets = new Pool($options->pooling(), static function () use ($address) { | 
                                                        |
| 59 | +        $this->sockets = new Pool($options->pooling(), static function() use ($address) { | 
                                                        |
| 60 | 60 | return new Socket($address);  | 
                                                        
| 61 | 61 | }, $options->identify());  | 
                                                        
| 62 | 62 | }  | 
                                                        
@@ -17,7 +17,7 @@  | 
                                                    ||
| 17 | 17 | */  | 
                                                        
| 18 | 18 | protected function packing(int $seq, string $message) : string  | 
                                                        
| 19 | 19 |      { | 
                                                        
| 20 | -        return pack('N', $seq) . pack('N', strlen($message)) . $message; | 
                                                        |
| 20 | +        return pack('N', $seq).pack('N', strlen($message)).$message; | 
                                                        |
| 21 | 21 | }  | 
                                                        
| 22 | 22 | |
| 23 | 23 | /**  | 
                                                        
@@ -20,6 +20,6 @@  | 
                                                    ||
| 20 | 20 | */  | 
                                                        
| 21 | 21 | protected function seq() : int  | 
                                                        
| 22 | 22 |      { | 
                                                        
| 23 | - return $this->seq ++ > 0xFFFFFFFF ? $this->seq = 1 : $this->seq;  | 
                                                        |
| 23 | + return $this->seq++ > 0xFFFFFFFF ? $this->seq = 1 : $this->seq;  | 
                                                        |
| 24 | 24 | }  | 
                                                        
| 25 | 25 | }  | 
                                                        
@@ -68,16 +68,16 @@ discard block  | 
                                                    ||
| 68 | 68 | $this->socket = Sock::connect(  | 
                                                        
| 69 | 69 | $this->connect,  | 
                                                        
| 70 | 70 | (new Events)  | 
                                                        
| 71 | -            ->attach(Events\Socket::CONNECTED, function () { | 
                                                        |
| 71 | +            ->attach(Events\Socket::CONNECTED, function() { | 
                                                        |
| 72 | 72 | $this->connected->resolve();  | 
                                                        
| 73 | 73 | })  | 
                                                        
| 74 | -            ->attach(Events\Socket::RECEIVED, function (Stream $conn) { | 
                                                        |
| 74 | +            ->attach(Events\Socket::RECEIVED, function(Stream $conn) { | 
                                                        |
| 75 | 75 | $this->reconciled->done(...$this->unpacking($conn->recv()));  | 
                                                        
| 76 | 76 | })  | 
                                                        
| 77 | -            ->attach(Events\Socket::CLOSED, function () { | 
                                                        |
| 77 | +            ->attach(Events\Socket::CLOSED, function() { | 
                                                        |
| 78 | 78 | $this->closed()->resolve();  | 
                                                        
| 79 | 79 | })  | 
                                                        
| 80 | -            ->attach(Events\Socket::ERROR, function () { | 
                                                        |
| 80 | +            ->attach(Events\Socket::ERROR, function() { | 
                                                        |
| 81 | 81 | $this->closed()->resolve();  | 
                                                        
| 82 | 82 | }),  | 
                                                        
| 83 | 83 | new Options(Config::SW_PACKAGE, Config::SW_SOCKET)  | 
                                                        
@@ -108,7 +108,7 @@ discard block  | 
                                                    ||
| 108 | 108 | */  | 
                                                        
| 109 | 109 | private function cleanup() : Promised  | 
                                                        
| 110 | 110 |      { | 
                                                        
| 111 | -        ($w = Promise::deferred())->then(function () { | 
                                                        |
| 111 | +        ($w = Promise::deferred())->then(function() { | 
                                                        |
| 112 | 112 | $this->reconciled->shutdown(new TransportNowClosedException);  | 
                                                        
| 113 | 113 | });  | 
                                                        
| 114 | 114 | return $w;  | 
                                                        
@@ -81,7 +81,7 @@  | 
                                                    ||
| 81 | 81 | */  | 
                                                        
| 82 | 82 | private function cleanup() : Promised  | 
                                                        
| 83 | 83 |      { | 
                                                        
| 84 | -        return Promise::deferred()->catch(function () { | 
                                                        |
| 84 | +        return Promise::deferred()->catch(function() { | 
                                                        |
| 85 | 85 | $this->from->free($this->seq);  | 
                                                        
| 86 | 86 | $this->from = null;  | 
                                                        
| 87 | 87 | });  | 
                                                        
@@ -58,7 +58,7 @@ discard block  | 
                                                    ||
| 58 | 58 | public function hooking(Events $events) : void  | 
                                                        
| 59 | 59 |      { | 
                                                        
| 60 | 60 | $events  | 
                                                        
| 61 | -        ->attach(Events\Server::CREATED, function (Conn $serv) { | 
                                                        |
| 61 | +        ->attach(Events\Server::CREATED, function(Conn $serv) { | 
                                                        |
| 62 | 62 | ($this->server = new Server($this->listen, $serv->server()->raw(), $serv->events()))->serve();  | 
                                                        
| 63 | 63 |              if ($port = $this->server->ported()) { | 
                                                        
| 64 | 64 | /**  | 
                                                        
@@ -71,7 +71,7 @@ discard block  | 
                                                    ||
| 71 | 71 |                  logger('hrpc-accel')->notice('TCP accelerator startup failed .. skip'); | 
                                                        
| 72 | 72 | }  | 
                                                        
| 73 | 73 | })  | 
                                                        
| 74 | -        ->attach(Events\Worker::STOPPED, function () { | 
                                                        |
| 74 | +        ->attach(Events\Worker::STOPPED, function() { | 
                                                        |
| 75 | 75 | $this->server->shutdown();  | 
                                                        
| 76 | 76 | });  | 
                                                        
| 77 | 77 | }  |