File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -17,10 +17,22 @@ public function __construct(LoopInterface $loop)
1717
1818 protected function createUnixSocket ()
1919 {
20- $ unixFile = sprintf ('tmp/%s.sock ' , $ this ->node );
20+ if (!defined ('EPROCESS_SOCKET_DIR ' )) {
21+ throw new \Exception ("EPROCESS_SOCKET_DIR is not defined. " );
22+ }
23+
24+ if (!defined ('EPROCESS_AUTOLOAD ' )) {
25+ throw new \Exception ('EPROCESS_AUTOLOAD is not defined. ' );
26+ }
27+
28+ if (!is_writable (EPROCESS_SOCKET_DIR )) {
29+ throw new \Exception (sprintf ("Cannot write to %s. " , EPROCESS_SOCKET_DIR ));
30+ }
31+
32+ $ unixFile = sprintf ('%s/%s.sock ' , EPROCESS_SOCKET_DIR , $ this ->node );
2133 $ unix = sprintf ('unix://%s ' , $ unixFile );
2234
23- $ cleanup = function () use ($ unixFile ) {
35+ $ cleanup = function () use ($ unixFile ) {
2436 $ this ->loop ->stop ();
2537 @unlink ($ unixFile );
2638 };
@@ -32,5 +44,6 @@ protected function createUnixSocket()
3244 }
3345
3446 abstract public function create ($ class , array $ data = []);
47+
3548 abstract public function kill ();
3649}
Original file line number Diff line number Diff line change 33declare (ticks = 1 );
44
55define ('EPROCESS_AUTOLOAD ' , __FILE__ );
6+ define ('EPROCESS_SOCKET_DIR ' , '/tmp/eprocess ' );
67
78$ loader = require __DIR__ . '/../vendor/autoload.php ' ;
89
You can’t perform that action at this time.
0 commit comments