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)
17
17
18
18
protected function createUnixSocket ()
19
19
{
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 );
21
33
$ unix = sprintf ('unix://%s ' , $ unixFile );
22
34
23
- $ cleanup = function () use ($ unixFile ) {
35
+ $ cleanup = function () use ($ unixFile ) {
24
36
$ this ->loop ->stop ();
25
37
@unlink ($ unixFile );
26
38
};
@@ -32,5 +44,6 @@ protected function createUnixSocket()
32
44
}
33
45
34
46
abstract public function create ($ class , array $ data = []);
47
+
35
48
abstract public function kill ();
36
49
}
Original file line number Diff line number Diff line change 3
3
declare (ticks = 1 );
4
4
5
5
define ('EPROCESS_AUTOLOAD ' , __FILE__ );
6
+ define ('EPROCESS_SOCKET_DIR ' , '/tmp/eprocess ' );
6
7
7
8
$ loader = require __DIR__ . '/../vendor/autoload.php ' ;
8
9
You can’t perform that action at this time.
0 commit comments