mirror of
https://github.com/danog/ipc.git
synced 2024-11-30 04:29:09 +01:00
cs-fix
This commit is contained in:
parent
e119d9d477
commit
cf179aff9d
@ -3,7 +3,6 @@ sudo: false
|
|||||||
language: php
|
language: php
|
||||||
|
|
||||||
php:
|
php:
|
||||||
- 7.0
|
|
||||||
- 7.1
|
- 7.1
|
||||||
- 7.2
|
- 7.2
|
||||||
- 7.3
|
- 7.3
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
require 'vendor/autoload.php';
|
require 'vendor/autoload.php';
|
||||||
|
|
||||||
use Amp\Loop;
|
|
||||||
use Amp\Ipc\Sync\ChannelledSocket;
|
use Amp\Ipc\Sync\ChannelledSocket;
|
||||||
|
use Amp\Loop;
|
||||||
|
|
||||||
use function Amp\asyncCall;
|
use function Amp\asyncCall;
|
||||||
use function Amp\Ipc\connect;
|
use function Amp\Ipc\connect;
|
||||||
@ -19,7 +19,7 @@ Loop::run(static function () {
|
|||||||
echo "Closed connection".PHP_EOL;
|
echo "Closed connection".PHP_EOL;
|
||||||
};
|
};
|
||||||
|
|
||||||
$channel = yield connect(sys_get_temp_dir().'/test');
|
$channel = yield connect(\sys_get_temp_dir().'/test');
|
||||||
asyncCall($clientHandler, $channel);
|
asyncCall($clientHandler, $channel);
|
||||||
yield $channel->send('ping');
|
yield $channel->send('ping');
|
||||||
});
|
});
|
@ -3,8 +3,8 @@
|
|||||||
require 'vendor/autoload.php';
|
require 'vendor/autoload.php';
|
||||||
|
|
||||||
use Amp\Ipc\IpcServer;
|
use Amp\Ipc\IpcServer;
|
||||||
use Amp\Loop;
|
|
||||||
use Amp\Ipc\Sync\ChannelledSocket;
|
use Amp\Ipc\Sync\ChannelledSocket;
|
||||||
|
use Amp\Loop;
|
||||||
|
|
||||||
use function Amp\asyncCall;
|
use function Amp\asyncCall;
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ Loop::run(static function () {
|
|||||||
echo "Closed connection".PHP_EOL."==========".PHP_EOL;
|
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()) {
|
while ($socket = yield $server->accept()) {
|
||||||
asyncCall($clientHandler, $socket);
|
asyncCall($clientHandler, $socket);
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
namespace Amp\Ipc;
|
namespace Amp\Ipc;
|
||||||
|
|
||||||
use Amp\Deferred;
|
use Amp\Deferred;
|
||||||
use Amp\Loop;
|
|
||||||
use Amp\Ipc\Sync\ChannelledSocket;
|
use Amp\Ipc\Sync\ChannelledSocket;
|
||||||
|
use Amp\Loop;
|
||||||
use Amp\Promise;
|
use Amp\Promise;
|
||||||
use Amp\Success;
|
use Amp\Success;
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ final class ChannelledSocket implements Channel
|
|||||||
if ($data instanceof ChannelCloseReq) {
|
if ($data instanceof ChannelCloseReq) {
|
||||||
yield $channel->send(new ChannelCloseAck);
|
yield $channel->send(new ChannelCloseAck);
|
||||||
$this->state |= self::GOT_FIN_MASK;
|
$this->state |= self::GOT_FIN_MASK;
|
||||||
} else if ($data instanceof ChannelCloseAck) {
|
} elseif ($data instanceof ChannelCloseAck) {
|
||||||
$this->state |= self::GOT_ACK_MASK;
|
$this->state |= self::GOT_ACK_MASK;
|
||||||
}
|
}
|
||||||
} while ($this->state !== self::GOT_ALL_MASK);
|
} while ($this->state !== self::GOT_ALL_MASK);
|
||||||
|
@ -17,7 +17,7 @@ use function Amp\call;
|
|||||||
function connect(string $uri): Promise
|
function connect(string $uri): Promise
|
||||||
{
|
{
|
||||||
return call(static function () use ($uri) {
|
return call(static function () use ($uri) {
|
||||||
if (!file_exists($uri)) {
|
if (!\file_exists($uri)) {
|
||||||
throw new \RuntimeException("The endpoint does not exist!");
|
throw new \RuntimeException("The endpoint does not exist!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class IpcTest extends AsyncTestCase
|
|||||||
|
|
||||||
public function provideUriFifo(): \Generator
|
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) {
|
if (\strncasecmp(\PHP_OS, "WIN", 3) === 0) {
|
||||||
yield [$uri, false];
|
yield [$uri, false];
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user