Skip to content

Commit

Permalink
Improved read & write
Browse files Browse the repository at this point in the history
  • Loading branch information
andot committed Dec 21, 2016
1 parent 0715c60 commit eac0588
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Hprose/Socket/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* *
* hprose socket Service library for php 5.3+ *
* *
* LastModified: Sep 17, 2016 *
* LastModified: Dec 21, 2016 *
* Author: Ma Bingyao <[email protected]> *
* *
\**********************************************************/
Expand Down Expand Up @@ -248,12 +248,16 @@ private function accept($server) {
$this->onReceives[(int)$socket] = $this->getOnReceive($server, $socket);
}
private function read($socket) {
$onReceive = $this->onReceives[(int)$socket];
$onReceive();
if (isset($this->onReceives[(int)$socket])) {
$onReceive = $this->onReceives[(int)$socket];
$onReceive();
}
}
private function write($socket) {
$onSend = $this->onSends[(int)$socket];
$onSend();
if (isset($this->onSends[(int)$socket])) {
$onSend = $this->onSends[(int)$socket];
$onSend();
}
}
private function close($socket, $context) {
$this->removeSocket($this->writeableSockets, $socket);
Expand Down

0 comments on commit eac0588

Please sign in to comment.