瀏覽代碼

Try to handle socket files better

Nathaniel van Diepen 7 年之前
父節點
當前提交
5eb8c3082f
共有 1 個文件被更改,包括 2 次插入5 次删除
  1. 2 5
      Net/socket.class.php

+ 2 - 5
Net/socket.class.php

@@ -72,15 +72,12 @@
 			$this->throw_if($this->socket);
 			if($this->socket_type == static::SERVER){
 				if(is_null($this->port)){
-					if(file_exists($this->address)){
-						chmod($this->address, 0702);
-					}elseif(function_exists('posix_mkfifo')){
-						posix_mkfifo($this->address, 0702);
-					}
 					$res = socket_bind($this->socket, $this->address);
 					if(!file_exists($this->address)){
 						throw new \Exception('Unable to create socket file');
 					}
+					chmod($this->address, 0702);
+					unlink($this->address); // Delete when we are done
 				}else{
 					$res = socket_bind($this->socket, $this->address, $this->port);
 				}