@@ -13,13 +13,13 @@ abstract class GenericLibevent
13
13
protected $ _server = null ;
14
14
protected $ _service = null ;
15
15
protected $ _master = null ;
16
- protected $ _read = array ();//буферы чтения
17
- protected $ _write = array ();//буферы заииси
16
+ protected $ _read = array ();//read buffers
17
+ protected $ _write = array ();//write buffers
18
18
private $ base = null ;
19
19
private $ event = null ;
20
20
private $ service_event = null ;
21
21
private $ master_event = null ;
22
- private $ buffers = array ();//буферы событий
22
+ private $ buffers = array ();//event buffers
23
23
public $ timer = null ;
24
24
25
25
public function start () {
@@ -110,25 +110,25 @@ private function master($connection, $flag, $base) {
110
110
111
111
private function onRead ($ buffer , $ connectionId ) {
112
112
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
114
114
$ this ->close ($ connectionId );
115
115
return ;
116
116
} else {
117
117
while ($ data = $ this ->_readFromBuffer ($ connectionId )) {
118
- $ this ->onServiceMessage ($ connectionId , $ data ); //вызываем пользовательский сценарий
118
+ $ this ->onServiceMessage ($ connectionId , $ data ); //call user handler
119
119
}
120
120
}
121
121
} 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
123
123
$ this ->close ($ connectionId );
124
124
return ;
125
125
} else {
126
126
while ($ data = $ this ->_readFromBuffer ($ connectionId )) {
127
- $ this ->onMasterMessage ($ data ); //вызываем пользовательский сценарий
127
+ $ this ->onMasterMessage ($ data ); //call user handler
128
128
}
129
129
}
130
130
} else {
131
- if (!$ this ->_read ($ connectionId )) { //соединение было закрыто или превышен размер буфера
131
+ if (!$ this ->_read ($ connectionId )) { //connection has been closed or the buffer was overwhelmed
132
132
$ this ->close ($ connectionId );
133
133
} else {
134
134
$ this ->_onMessage ($ connectionId );
@@ -174,7 +174,7 @@ protected function _read($connectionId) {
174
174
175
175
if (!strlen ($ data )) return ;
176
176
177
- @$ this ->_read [$ connectionId ] .= $ data ;//добавляем полученные данные в буфер чтения
177
+ @$ this ->_read [$ connectionId ] .= $ data ;//add the data into the read buffer
178
178
return strlen ($ this ->_read [$ connectionId ]) < self ::MAX_SOCKET_BUFFER_SIZE ;
179
179
}
180
- }
180
+ }
0 commit comments