From 33e39c735545e6f855eac0ec8c57c407f7918ae1 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 7 Oct 2012 11:03:09 +0200 Subject: [PATCH] sac-a-push: auto-logout cleanup of sockets array fixed --- web/Obj/sac-a-push.phh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/web/Obj/sac-a-push.phh b/web/Obj/sac-a-push.phh index fd0368b..a06ef40 100644 --- a/web/Obj/sac-a-push.phh +++ b/web/Obj/sac-a-push.phh @@ -262,6 +262,23 @@ class Sac_a_push { 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) { @@ -391,10 +408,8 @@ class Sac_a_push { } } } - - - $this->app->garbage_manager(FALSE); + $this->garbage_manager(FALSE); /* manage unfinished pages */ foreach ($this->pages_flush as $k => $pgflush) { -- 2.17.1