diff options
author | Wolfy-J <[email protected]> | 2018-01-23 19:51:15 -0500 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-01-23 19:51:15 -0500 |
commit | 78a42de837928cf7d10a1ae04d7e82e56d66e1e2 (patch) | |
tree | 8882b9a051bcc9c42328df583c0bb8c39a89591e /source | |
parent | fa4bd78d9f7c5f74e8445374370927c742fc4e78 (diff) |
API update
Diffstat (limited to 'source')
-rw-r--r-- | source/Worker.php | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/source/Worker.php b/source/Worker.php index d31b48bd..57e8fbf5 100644 --- a/source/Worker.php +++ b/source/Worker.php @@ -87,6 +87,7 @@ class Worker $this->relay->send($context, Relay::PAYLOAD_CONTROL | Relay::PAYLOAD_RAW); } + //todo: null payload? $this->relay->send($payload, Relay::PAYLOAD_RAW); } @@ -136,26 +137,23 @@ class Worker return true; } - $parsed = json_decode($body, true); - if ($parsed === false) { + $p = json_decode($body, true); + if ($p === false) { throw new RoadRunnerException("invalid task context, JSON payload is expected"); } // PID negotiation (socket connections only) - if (!empty($parsed['pid'])) { - $this->relay->send(json_encode([ - 'pid' => getmypid(), - 'parent' => $parsed['pid'], - ]), Relay::PAYLOAD_CONTROL); + if (!empty($p['pid'])) { + $this->relay->send(sprintf('{"pid":%s}', getmypid()), Relay::PAYLOAD_CONTROL); } // termination request - if (!empty($parsed['terminate'])) { + if (!empty($p['stop'])) { return false; } // not a command but execution context - $context = $parsed; + $context = $p; return true; } |