Linux unitednationsplay.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
nginx/1.20.1
Server IP : 188.130.139.92 & Your IP : 3.135.201.190
Domains :
Cant Read [ /etc/named.conf ]
User : web
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
www /
3 /
react /
event-loop /
tests /
Delete
Unzip
Name
Size
Permission
Date
Action
Timer
[ DIR ]
drwxr-xr-x
2018-07-11 09:00
AbstractLoopTest.php
17.24
KB
-rw-r--r--
2018-07-11 09:00
CallableStub.php
107
B
-rw-r--r--
2018-07-11 09:00
ExtEvLoopTest.php
355
B
-rw-r--r--
2018-07-11 09:00
ExtEventLoopTest.php
2.33
KB
-rw-r--r--
2018-07-11 09:00
ExtLibevLoopTest.php
454
B
-rw-r--r--
2018-07-11 09:00
ExtLibeventLoopTest.php
1.38
KB
-rw-r--r--
2018-07-11 09:00
SignalsHandlerTest.php
1.33
KB
-rw-r--r--
2018-07-11 09:00
StreamSelectLoopTest.php
3.96
KB
-rw-r--r--
2018-07-11 09:00
TestCase.php
1.11
KB
-rw-r--r--
2018-07-11 09:00
bootstrap.php
118
B
-rw-r--r--
2018-07-11 09:00
Save
Rename
<?php namespace React\Tests\EventLoop; use React\EventLoop\LoopInterface; use React\EventLoop\StreamSelectLoop; class StreamSelectLoopTest extends AbstractLoopTest { protected function tearDown() { parent::tearDown(); if (strncmp($this->getName(false), 'testSignal', 10) === 0 && extension_loaded('pcntl')) { $this->resetSignalHandlers(); } } public function createLoop() { return new StreamSelectLoop(); } public function testStreamSelectTimeoutEmulation() { $this->loop->addTimer( 0.05, $this->expectCallableOnce() ); $start = microtime(true); $this->loop->run(); $end = microtime(true); $interval = $end - $start; $this->assertGreaterThan(0.04, $interval); } public function signalProvider() { return array( array('SIGUSR1'), array('SIGHUP'), array('SIGTERM'), ); } /** * Test signal interrupt when no stream is attached to the loop * @dataProvider signalProvider */ public function testSignalInterruptNoStream($signal) { if (!extension_loaded('pcntl')) { $this->markTestSkipped('"pcntl" extension is required to run this test.'); } // dispatch signal handler every 10ms for 0.1s $check = $this->loop->addPeriodicTimer(0.01, function() { pcntl_signal_dispatch(); }); $loop = $this->loop; $loop->addTimer(0.1, function () use ($check, $loop) { $loop->cancelTimer($check); }); $handled = false; $this->assertTrue(pcntl_signal(constant($signal), function () use (&$handled) { $handled = true; })); // spawn external process to send signal to current process id $this->forkSendSignal($signal); $this->loop->run(); $this->assertTrue($handled); } /** * Test signal interrupt when a stream is attached to the loop * @dataProvider signalProvider */ public function testSignalInterruptWithStream($signal) { if (!extension_loaded('pcntl')) { $this->markTestSkipped('"pcntl" extension is required to run this test.'); } // dispatch signal handler every 10ms $this->loop->addPeriodicTimer(0.01, function() { pcntl_signal_dispatch(); }); // add stream to the loop $loop = $this->loop; list($writeStream, $readStream) = $this->createSocketPair(); $loop->addReadStream($readStream, function ($stream) use ($loop) { /** @var $loop LoopInterface */ $read = fgets($stream); if ($read === "end loop\n") { $loop->stop(); } }); $this->loop->addTimer(0.1, function() use ($writeStream) { fwrite($writeStream, "end loop\n"); }); $handled = false; $this->assertTrue(pcntl_signal(constant($signal), function () use (&$handled) { $handled = true; })); // spawn external process to send signal to current process id $this->forkSendSignal($signal); $this->loop->run(); $this->assertTrue($handled); } /** * reset all signal handlers to default */ protected function resetSignalHandlers() { foreach($this->signalProvider() as $signal) { pcntl_signal(constant($signal[0]), SIG_DFL); } } /** * fork child process to send signal to current process id */ protected function forkSendSignal($signal) { $currentPid = posix_getpid(); $childPid = pcntl_fork(); if ($childPid == -1) { $this->fail("Failed to fork child process!"); } else if ($childPid === 0) { // this is executed in the child process usleep(20000); posix_kill($currentPid, constant($signal)); die(); } } }