Skip to content

Commit 5cc91da

Browse files
authoredJun 21, 2016
Update GenericLibevent.php
1 parent 2de9a34 commit 5cc91da

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed
 

‎GenericLibevent.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ abstract class GenericLibevent
1313
protected $_server = null;
1414
protected $_service = null;
1515
protected $_master = null;
16-
protected $_read = array();//буферы чтения
17-
protected $_write = array();//буферы заииси
16+
protected $_read = array();//read buffers
17+
protected $_write = array();//write buffers
1818
private $base = null;
1919
private $event = null;
2020
private $service_event = null;
2121
private $master_event = null;
22-
private $buffers = array();//буферы событий
22+
private $buffers = array();//event buffers
2323
public $timer = null;
2424

2525
public function start() {
@@ -110,25 +110,25 @@ private function master($connection, $flag, $base) {
110110

111111
private function onRead($buffer, $connectionId) {
112112
if (isset($this->services[$connectionId])) {
113-
if (is_null($this->_read($connectionId))) { //соединение было закрыто или превышен размер буфера
113+
if (is_null($this->_read($connectionId))) { //connection has been closed or the buffer was overwhelmed
114114
$this->close($connectionId);
115115
return;
116116
} else {
117117
while ($data = $this->_readFromBuffer($connectionId)) {
118-
$this->onServiceMessage($connectionId, $data); //вызываем пользовательский сценарий
118+
$this->onServiceMessage($connectionId, $data); //call user handler
119119
}
120120
}
121121
} elseif ($this->getIdByConnection($this->_master) == $connectionId) {
122-
if (is_null($this->_read($connectionId))) { //соединение было закрыто или превышен размер буфера
122+
if (is_null($this->_read($connectionId))) { //connection has been closed or the buffer was overwhelmed
123123
$this->close($connectionId);
124124
return;
125125
} else {
126126
while ($data = $this->_readFromBuffer($connectionId)) {
127-
$this->onMasterMessage($data); //вызываем пользовательский сценарий
127+
$this->onMasterMessage($data); //call user handler
128128
}
129129
}
130130
} else {
131-
if (!$this->_read($connectionId)) { //соединение было закрыто или превышен размер буфера
131+
if (!$this->_read($connectionId)) { //connection has been closed or the buffer was overwhelmed
132132
$this->close($connectionId);
133133
} else {
134134
$this->_onMessage($connectionId);
@@ -174,7 +174,7 @@ protected function _read($connectionId) {
174174

175175
if (!strlen($data)) return;
176176

177-
@$this->_read[$connectionId] .= $data;//добавляем полученные данные в буфер чтения
177+
@$this->_read[$connectionId] .= $data;//add the data into the read buffer
178178
return strlen($this->_read[$connectionId]) < self::MAX_SOCKET_BUFFER_SIZE;
179179
}
180-
}
180+
}

0 commit comments

Comments
 (0)