Skip to content
This repository has been archived by the owner on Mar 6, 2019. It is now read-only.

Commit

Permalink
Stop command fix
Browse files Browse the repository at this point in the history
  • Loading branch information
CupOfTea696 committed Jun 4, 2015
1 parent 07a53d5 commit ecb15a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/Server/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,21 @@ public function push($message){
$data = $message['data'];
$recipient = array_get($message, 'recipient');

if (!$topic)
return;

// Handle TwoStream::stop();
if ($topic = 'cupoftea/twostream/server/stop') {
if ($message['topic'] == 'cupoftea/twostream/server/stop') {
$this->output->writeln("Stop Command fired.");
$this->output->writeln("<question>Stopping Server.</question>");

if ($data['secret'] == config('app.key')) {
die();
} else {
// report malicious attempt
}
}

if (!$topic)
return;

if ($recipient == 'all') {
$topic->broadcast($data);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/TwoStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function stop()
'data' => [
'secret' => config('app.key')
],
'recipient' => $recipient,
'recipient' => 'server',
])
);
}
Expand Down

0 comments on commit ecb15a9

Please sign in to comment.