From 3f1728907126e3fb009ae8652bdc4bb333f13f31 Mon Sep 17 00:00:00 2001 From: Valentin V / vvval Date: Tue, 21 Apr 2020 20:30:15 +0300 Subject: #305 Replace multiple sys_calls with a combined one --- src/Worker.php | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'src') diff --git a/src/Worker.php b/src/Worker.php index 74296801..d9de0fa9 100644 --- a/src/Worker.php +++ b/src/Worker.php @@ -82,27 +82,10 @@ class Worker * @param string|null $header */ public function send(string $payload = null, string $header = null): void - { - if ($header === null) { - $this->relay->send('', Relay::PAYLOAD_CONTROL | Relay::PAYLOAD_NONE); - } else { - $this->relay->send($header, Relay::PAYLOAD_CONTROL | Relay::PAYLOAD_RAW); - } - - $this->relay->send((string)$payload, Relay::PAYLOAD_RAW); - } - - /** - * Respond to the server with result of task execution and execution context. Uses less amount of sys_calls. - * - * @param string|null $payload - * @param string|null $header - */ - public function sendPackage(string $payload = null, string $header = null): void { $this->relay->sendPackage( (string)$header, - Relay::PAYLOAD_CONTROL | ($header ? Relay::PAYLOAD_NONE : Relay::PAYLOAD_RAW), + Relay::PAYLOAD_CONTROL | ($header === null ? Relay::PAYLOAD_NONE : Relay::PAYLOAD_RAW), (string)$payload, Relay::PAYLOAD_RAW ); -- cgit v1.2.3