Changeset 2253
- Timestamp:
- 06/23/09 21:44:28 (13 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
framework/trunk/src/main/php/net/stubbles/peer/stubSocket.php
r1880 r2253 71 71 public function connect() 72 72 { 73 if ($this->isConnected() == true) {73 if ($this->isConnected() === true) { 74 74 return true; 75 75 } … … 96 96 public function disconnect() 97 97 { 98 if ($this->isConnected() == true) {98 if ($this->isConnected() === true) { 99 99 fclose($this->fp); 100 100 $this->fp = null; … … 110 110 { 111 111 $this->timeout = $timeout; 112 if ($this->isConnected() == true) {112 if ($this->isConnected() === true) { 113 113 socket_set_timeout($this->fp, $this->timeout); 114 114 } … … 125 125 public function read($length = 4096) 126 126 { 127 if ($this->isConnected() == false) {127 if ($this->isConnected() === false) { 128 128 throw new stubIllegalStateException('Can not read on unconnected socket.'); 129 129 } … … 131 131 $data = fgets($this->fp, $length); 132 132 if (false === $data) { 133 // fgets returns false on eof while feof() returned false before 134 // but will now return true 135 if ($this->eof() === true) { 136 return null; 137 } 138 133 139 throw new stubConnectionException('Reading of ' . $length . ' bytes failed.'); 134 140 } … … 158 164 public function readBinary($length = 1024) 159 165 { 160 if ($this->isConnected() == false) {166 if ($this->isConnected() === false) { 161 167 throw new stubIllegalStateException('Can not read on unconnected socket.'); 162 168 } … … 180 186 public function write($data) 181 187 { 182 if ($this->isConnected() == false) {188 if ($this->isConnected() === false) { 183 189 throw new stubIllegalStateException('Can not write on unconnected socket.'); 184 190 } … … 239 245 public function eof() 240 246 { 241 if ($this->isConnected() == true) {247 if ($this->isConnected() === true) { 242 248 return feof($this->fp); 243 249 }
