url protocol parametrization and some typo
[brisk.git] / web / Obj / sac-a-push.phh
index a3fe932..df6de09 100644 (file)
@@ -35,7 +35,7 @@ $_globals_list = array(
 'G_admin_mail', 'G_alarm_passwd', 'G_all_points', 'G_ban_list', 'G_base',
 'G_black_list', 'G_brisk_version', 'G_btrace_pref_sub', 'G_cloud_smasher',
 'G_crypt_key', 'G_dbasetype', 'G_dbauth', 'G_dbpfx', 'G_doc_path',
-'G_domain', 'G_donors_all', 'G_donors_cur', 'G_is_local', 'G_lang', 'G_lng',
+'G_proto', 'G_domain', 'G_donors_all', 'G_donors_cur', 'G_is_local', 'G_lang', 'G_lng',
 'G_mail_seed', 'G_notguar_code', 'G_PG_cons', 'G_PG_cons_n', 'G_PG_vow',
 'G_PG_vow_n', 'G_poll_entries', 'G_poll_name', 'G_poll_title',
 'G_provider_proxy', 'G_proxy_white_list', 'G_room_about', 'G_room_help',
@@ -571,7 +571,7 @@ class Sac_a_push {
 
     function pendpage_try_addcont(&$new_socket, $tout, $method, $header, $get, $post, $cookie, $path, $addr, $rest, $cont)
     {
-        $pendpage = PendingPage::pendingpage_continue(&$new_socket, $this->curtime, $tout, $method,
+        $pendpage = PendingPage::pendingpage_continue( $new_socket, $this->curtime, $tout, $method,
                                                            $header,           $get, $post, $cookie,
                                                              $path,          $addr, $rest, $cont);
 
@@ -631,14 +631,18 @@ class Sac_a_push {
         foreach ($this->socks as $k => $sock) {
             $id = intval($sock);
             if (isset($this->s2u[$id])) {
-                if ($this->s2u[$id]->the_end) {
-                    if ($this->s2u[$id]->rd_socket_get() != NULL) {
-                        $this->s2u[$id]->rd_socket_set(NULL);
+                $user = $this->s2u[$id];
+                if ($user->the_end) {
+                    if (($user->rd_toflush == FALSE && $user->rd_step == $user->step)
+                        || $user->rd_endtime_is_expired($this->curtime)) {
+                        if ($user->rd_socket_get() != NULL) {
+                            $user->rd_socket_set(NULL);
+                        }
+                        unset($this->socks[$id]);
+                        unset($this->s2u[$id]);
+                        fclose($sock);
+                        printf("CLOSE ON GARBAGE MANAGER\n");
                     }
-                    unset($this->socks[$id]);
-                    unset($this->s2u[$id]);
-                    fclose($sock);
-                    printf("CLOSE ON GARBAGE MANAGER\n");
                 }
             }
         }
@@ -1033,7 +1037,7 @@ class Sac_a_push {
                 return cmd_return(401, 'malformed cmd');
             }
             $idx = -1;
-            if (($user = $this->app->get_user($cmd['sess'], &$idx)) == FALSE)
+            if (($user = $this->app->get_user($cmd['sess'], $idx)) == FALSE)
                 return cmd_return(402, 'user not found');
 
             if (($user->flags & USER_FLAG_TY_ADMIN) == 0x00)