File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace EProcess \Adapter ;
4
4
5
+ use Ratchet \Wamp \Exception ;
5
6
use React \EventLoop \LoopInterface ;
6
7
7
8
abstract class BaseAdapter
@@ -17,7 +18,15 @@ public function __construct(LoopInterface $loop)
17
18
18
19
protected function createUnixSocket ()
19
20
{
20
- $ unixFile = sprintf ('tmp/%s.sock ' , $ this ->node );
21
+ if (!defined ('SOCKET_PATH ' ))
22
+ throw new \Exception ("SOCKET_PATH is not defined. " );
23
+
24
+ if (!is_writable (SOCKET_PATH )){
25
+ if (!mkdir (SOCKET_PATH ))
26
+ throw new \Exception ("Cannot create folder at SOCKET_PATH. " );
27
+ }
28
+
29
+ $ unixFile = sprintf ('%s/%s.sock ' , SOCKET_PATH , $ this ->node );
21
30
$ unix = sprintf ('unix://%s ' , $ unixFile );
22
31
23
32
$ cleanup = function () use ($ unixFile ) {
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
+ define ('SOCKET_PATH ' , '/tmp/eprocess ' );
4
+
3
5
require_once __DIR__ . '/autoload.php ' ;
4
6
5
7
use Doctrine \Common \Annotations \AnnotationRegistry ;
You can’t perform that action at this time.
0 commit comments