Fixed Socket Exception bug, forgot to pass context
This commit is contained in:
Chris Boden 2011-11-21 11:13:41 -05:00
parent 62962bb27f
commit c5597edd55

View File

@ -72,7 +72,7 @@ class Socket implements SocketInterface {
public function bind($address, $port = 0) { public function bind($address, $port = 0) {
if (false === @socket_bind($this->getResource(), $address, $port)) { if (false === @socket_bind($this->getResource(), $address, $port)) {
throw new Exception; throw new Exception($this);
} }
return $this; return $this;
@ -85,7 +85,7 @@ class Socket implements SocketInterface {
public function connect($address, $port = 0) { public function connect($address, $port = 0) {
if (false === @socket_connect($this->getResource(), $address, $port)) { if (false === @socket_connect($this->getResource(), $address, $port)) {
throw new Exception; throw new Exception($this);
} }
return $this; return $this;
@ -94,7 +94,7 @@ class Socket implements SocketInterface {
public function getRemoteAddress() { public function getRemoteAddress() {
$address = $port = ''; $address = $port = '';
if (false === @socket_getpeername($this->getResource(), $address, $port)) { if (false === @socket_getpeername($this->getResource(), $address, $port)) {
throw new Exception; throw new Exception($this);
} }
return $address; return $address;
@ -102,7 +102,7 @@ class Socket implements SocketInterface {
public function get_option($level, $optname) { public function get_option($level, $optname) {
if (false === ($res = @socket_get_option($this->getResource(), $level, $optname))) { if (false === ($res = @socket_get_option($this->getResource(), $level, $optname))) {
throw new Exception; throw new Exception($this);
} }
return $res; return $res;
@ -110,7 +110,7 @@ class Socket implements SocketInterface {
public function listen($backlog = 0) { public function listen($backlog = 0) {
if (false === @socket_listen($this->getResource(), $backlog)) { if (false === @socket_listen($this->getResource(), $backlog)) {
throw new Exception; throw new Exception($this);
} }
return $this; return $this;
@ -159,7 +159,7 @@ class Socket implements SocketInterface {
public function set_block() { public function set_block() {
if (false === @socket_set_block($this->getResource())) { if (false === @socket_set_block($this->getResource())) {
throw new Exception; throw new Exception($this);
} }
return $this; return $this;
@ -167,7 +167,7 @@ class Socket implements SocketInterface {
public function set_nonblock() { public function set_nonblock() {
if (false === @socket_set_nonblock($this->getResource())) { if (false === @socket_set_nonblock($this->getResource())) {
throw new Exception; throw new Exception($this);
} }
return $this; return $this;
@ -175,7 +175,7 @@ class Socket implements SocketInterface {
public function set_option($level, $optname, $optval) { public function set_option($level, $optname, $optval) {
if (false === @socket_set_option($this->getResource(), $level, $optname, $optval)) { if (false === @socket_set_option($this->getResource(), $level, $optname, $optval)) {
throw new Exception; throw new Exception($this);
} }
return $this; return $this;
@ -183,7 +183,7 @@ class Socket implements SocketInterface {
public function shutdown($how = 2) { public function shutdown($how = 2) {
if (false === @socket_shutdown($this->getResource(), $how)) { if (false === @socket_shutdown($this->getResource(), $how)) {
throw new Exception; throw new Exception($this);
} }
return $this; return $this;
@ -191,7 +191,7 @@ class Socket implements SocketInterface {
public function write($buffer, $length = 0) { public function write($buffer, $length = 0) {
if (false === ($res = @socket_write($this->getResource(), $buffer, $length))) { if (false === ($res = @socket_write($this->getResource(), $buffer, $length))) {
throw new Exception; throw new Exception($this);
} }
return $res; return $res;