Переглянути джерело

Throw error when socket file creation can't happen

Nathaniel van Diepen 7 роки тому
батько
коміт
df8464b4a5
1 змінених файлів з 4 додано та 2 видалено
  1. 4 2
      Net/socket.class.php

+ 4 - 2
Net/socket.class.php

@@ -76,8 +76,10 @@
 						chmod($this->address, 0702);
 					}elseif(function_exists('posix_mkfifo')){
 						posix_mkfifo($this->address, 0702);
+					}else{
+						throw new \Exception('Unable to create socket file');
 					}
-					socket_bind($this->socket, $this->address);
+					$res = socket_bind($this->socket, $this->address);
 				}else{
 					$res = socket_bind($this->socket, $this->address, $this->port);
 				}
@@ -87,7 +89,7 @@
 				$this->fire('listen', $this);
 			}elseif($this->socket_type == static::CLIENT){
 				if(is_null($this->port)){
-					socket_connect($this->socket, $this->address);
+					$res = socket_connect($this->socket, $this->address);
 				}else{
 					$res = socket_connect($this->socket, $this->address, $this->port);
 				}