array_push($this->pages_flush, $pgflush);
}
+ function garbage_manager($force)
+ {
+ $this->app->garbage_manager($force);
+
+ foreach ($this->socks as $k => $sock) {
+ if ($this->s2u[intval($sock)]->sess == '') {
+ if ($this->s2u[intval($sock)]->rd_socket_get() != NULL) {
+ $this->s2u[intval($sock)]->rd_socket_set(NULL);
+ }
+ unset($this->socks[intval($sock)]);
+ unset($this->s2u[intval($sock)]);
+ fclose($sock);
+ printf("CLOSE ON GARBAGE MANAGER\n");
+ }
+ }
+ }
+
function run()
{
if ($this->main_loop) {
}
}
}
-
-
- $this->app->garbage_manager(FALSE);
+ $this->garbage_manager(FALSE);
/* manage unfinished pages */
foreach ($this->pages_flush as $k => $pgflush) {
if (isset($this->s2u[intval($sock)])) {
$user = $this->s2u[intval($sock)];
$response = $user->rd_cache_get();
- if (($this->curtime - $user->lacc) <= (EXPIRE_TIME_RD / 2)) {
+ $do_ping = FALSE;
+ if (($this->curtime - $user->lacc) > (EXPIRE_TIME_RD / 3)) {
+ $do_ping = TRUE;
+ }
+ else {
$user->ping_req = FALSE;
}
+
if ($response == "") {
$content = "";
$user->stream_main($content, $get, $post, $cookie);
printf("[%s] [%d] [%d]\n", $user->name, $user->lacc, $this->curtime);
- if ($user->ping_req == FALSE
- && (($this->curtime - $user->lacc) > (EXPIRE_TIME_RD / 2))) {
+ if ($do_ping && $user->ping_req == FALSE) {
$content .= $user->stream_keepalive(TRUE);
$user->ping_req = TRUE;
}