@@ -133,25 +133,25 @@ public function service() {
133
133
// Build array of sockets that we want to check for data. If one of them
134
134
// has disconnected in the meantime, notify the listeners (socket will be
135
135
// already invalid at that time) and remove it from the clients list.
136
- $ read = [$ this ->socket ->getHandle ()];
137
- $ currentTime = time ();
138
- foreach ($ handles as $ h => $ handle ) {
139
- if (!$ handle ->isConnected ()) {
140
- $ this ->protocol ->handleDisconnect ($ handle );
141
- unset($ handles [$ h ]);
142
- unset($ lastAction [$ h ]);
143
- } else if ($ currentTime - $ lastAction [$ h ] > $ handle ->getTimeout ()) {
144
- $ this ->protocol ->handleError ($ handle , new \peer \SocketTimeoutException ('Timed out ' , $ handle ->getTimeout ()));
145
- $ handle ->close ();
146
- unset($ handles [$ h ]);
147
- unset($ lastAction [$ h ]);
148
- } else {
149
- $ read []= $ handle ->getHandle ();
136
+ do {
137
+ $ read = [$ this ->socket ->getHandle ()];
138
+ $ currentTime = time ();
139
+ foreach ($ handles as $ h => $ handle ) {
140
+ if (!$ handle ->isConnected ()) {
141
+ $ this ->protocol ->handleDisconnect ($ handle );
142
+ unset($ handles [$ h ]);
143
+ unset($ lastAction [$ h ]);
144
+ } else if ($ currentTime - $ lastAction [$ h ] > $ handle ->getTimeout ()) {
145
+ $ this ->protocol ->handleError ($ handle , new \peer \SocketTimeoutException ('Timed out ' , $ handle ->getTimeout ()));
146
+ $ handle ->close ();
147
+ unset($ handles [$ h ]);
148
+ unset($ lastAction [$ h ]);
149
+ } else {
150
+ $ read []= $ handle ->getHandle ();
151
+ }
150
152
}
151
- }
152
153
153
- // Check to see if there are sockets with data on it.
154
- do {
154
+ // Check to see if there are sockets with data on it.
155
155
$ n = $ sockets ->select0 ($ read , $ null , $ null , $ timeout );
156
156
} while (0 === $ n );
157
157
0 commit comments