@@ -17,18 +17,22 @@ public function __construct(LoopInterface $loop)
1717
1818 protected function createUnixSocket ()
1919 {
20- if (!defined ('SOCKET_PATH ' ))
21- throw new \Exception ("SOCKET_PATH is not defined. " );
22-
23- if (!is_writable (SOCKET_PATH )){
24- if (!mkdir (SOCKET_PATH ))
25- throw new \Exception ("Cannot create folder at SOCKET_PATH. " );
20+ if (!defined ('EPROCESS_SOCKET_DIR ' )) {
21+ throw new \Exception ("EPROCESS_SOCKET_DIR is not defined. " );
2622 }
2723
28- $ unixFile = sprintf ('%s/%s.sock ' , SOCKET_PATH , $ this ->node );
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 );
2933 $ unix = sprintf ('unix://%s ' , $ unixFile );
3034
31- $ cleanup = function () use ($ unixFile ) {
35+ $ cleanup = function () use ($ unixFile ) {
3236 $ this ->loop ->stop ();
3337 @unlink ($ unixFile );
3438 };
@@ -40,5 +44,6 @@ protected function createUnixSocket()
4044 }
4145
4246 abstract public function create ($ class , array $ data = []);
47+
4348 abstract public function kill ();
4449}
0 commit comments