Skip to content

Commit

Permalink
Remove sockets on main shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
cursedcoder committed Sep 21, 2014
1 parent 1db5357 commit 0548ca3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions EProcess/Adapter/PThreads.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public function create($class, array $data = [])
$node = uniqid('thread_');
$unix = sprintf('unix://tmp/%s.sock', $node);

register_shutdown_function(function() use ($unix) {
unlink($unix);
});

$messenger = MessengerFactory::server($unix, $this->loop);

$this->process = new Thread($unix, $class, $data);
Expand Down
4 changes: 4 additions & 0 deletions EProcess/Adapter/SymfonyProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public function create($class, array $data = [])
$node = uniqid('thread_');
$unix = sprintf('unix://app/cache/%s.sock', $node);

register_shutdown_function(function() use ($unix) {
unlink($unix);
});

$messenger = MessengerFactory::server($unix, $this->loop);

$script = sprintf($this->script, EPROCESS_AUTOLOAD, $unix, $class, base64_encode($this->serialize($data)));
Expand Down

0 comments on commit 0548ca3

Please sign in to comment.