1
0
mirror of https://github.com/danog/ipc.git synced 2024-11-30 04:29:09 +01:00
This commit is contained in:
Daniil Gentili 2020-03-05 21:16:53 +01:00
parent e119d9d477
commit cf179aff9d
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
8 changed files with 12 additions and 13 deletions

View File

@ -3,7 +3,6 @@ sudo: false
language: php
php:
- 7.0
- 7.1
- 7.2
- 7.3

View File

@ -2,8 +2,8 @@
require 'vendor/autoload.php';
use Amp\Loop;
use Amp\Ipc\Sync\ChannelledSocket;
use Amp\Loop;
use function Amp\asyncCall;
use function Amp\Ipc\connect;
@ -19,7 +19,7 @@ Loop::run(static function () {
echo "Closed connection".PHP_EOL;
};
$channel = yield connect(sys_get_temp_dir().'/test');
$channel = yield connect(\sys_get_temp_dir().'/test');
asyncCall($clientHandler, $channel);
yield $channel->send('ping');
});

View File

@ -3,8 +3,8 @@
require 'vendor/autoload.php';
use Amp\Ipc\IpcServer;
use Amp\Loop;
use Amp\Ipc\Sync\ChannelledSocket;
use Amp\Loop;
use function Amp\asyncCall;
@ -22,7 +22,7 @@ Loop::run(static function () {
echo "Closed connection".PHP_EOL."==========".PHP_EOL;
};
$server = new IpcServer(sys_get_temp_dir().'/test');
$server = new IpcServer(\sys_get_temp_dir().'/test');
while ($socket = yield $server->accept()) {
asyncCall($clientHandler, $socket);
}

View File

@ -3,8 +3,8 @@
namespace Amp\Ipc;
use Amp\Deferred;
use Amp\Loop;
use Amp\Ipc\Sync\ChannelledSocket;
use Amp\Loop;
use Amp\Promise;
use Amp\Success;

View File

@ -86,7 +86,7 @@ final class ChannelledSocket implements Channel
if ($data instanceof ChannelCloseReq) {
yield $channel->send(new ChannelCloseAck);
$this->state |= self::GOT_FIN_MASK;
} else if ($data instanceof ChannelCloseAck) {
} elseif ($data instanceof ChannelCloseAck) {
$this->state |= self::GOT_ACK_MASK;
}
} while ($this->state !== self::GOT_ALL_MASK);

View File

@ -17,7 +17,7 @@ use function Amp\call;
function connect(string $uri): Promise
{
return call(static function () use ($uri) {
if (!file_exists($uri)) {
if (!\file_exists($uri)) {
throw new \RuntimeException("The endpoint does not exist!");
}

View File

@ -34,7 +34,7 @@ class IpcTest extends AsyncTestCase
public function provideUriFifo(): \Generator
{
foreach (['', sys_get_temp_dir().'/pony'] as $uri) {
foreach (['', \sys_get_temp_dir().'/pony'] as $uri) {
if (\strncasecmp(\PHP_OS, "WIN", 3) === 0) {
yield [$uri, false];
} else {