+
+
+ /* shared locking to load info */
+ if (($sem = Room::lock_data(FALSE)) == FALSE) {
+ // wait 20 secs, then restart the xhr
+ ignore_user_abort(FALSE);
+ return ("sleep(gst,20000);|hstm.xhr_abort();");
+ }
+
+ // Verifica l'expire time lato server
+ if (($user = User::load_data($proxy_step['i'], $sess)) == FALSE) {
+ Room::unlock_data($sem);
+ ignore_user_abort(FALSE);
+ return (blocking_error(TRUE));
+ }
+ /* if lacc time great than STREAM_TIMEOUT or the room garbage_time is expired
+ switch to exclusive locking and verify again the conditions */
+ if ((($curtime - $user->lacc) > STREAM_TIMEOUT) || Room::garbage_time_is_expired($curtime)) {
+ /* there is some info that require to change data, switch to exclusive locking */
+ Room::unlock_data($sem);
+ if (($sem = Room::lock_data(TRUE)) == FALSE) {
+ // wait 20 secs, then restart the xhr
+ ignore_user_abort(FALSE);
+ return ("sleep(gst,20000);|hstm.xhr_abort();");
+ }
+ $S_load_stat['lL_laccgarb']++;
+
+ // load again the data after locking
+ unset($user);
+ // Verifica l'expire time lato server
+ if (($user = User::load_data($proxy_step['i'], $sess)) == FALSE) {
+ Room::unlock_data($sem);
+ ignore_user_abort(FALSE);
+ return (blocking_error(TRUE));
+ }
+
+ if (($curtime - $user->lacc) >= STREAM_TIMEOUT) {
+ $S_load_stat['wU_lacc_upd']++;
+ $user->lacc = $curtime;
+ // lacc field updated
+ User::save_data($user, $user->idx);
+ }
+
+ if (Room::garbage_time_is_expired($curtime)) {
+ log_only("F");
+
+ $S_load_stat['wR_garbage']++;
+ if (($room = Room::load_data()) == FALSE) {