Warning: session_start(): open(/var/lib/php/sessions/sess_hss62o2019hg1hm1mvtj9t2r02, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
set flag ExpiringMap2_debug.
static long timeout = 60000;
static ExpiringMap2 recenctlyConnectedComputers_internal = new ExpiringMap2(5000, f updateValue);
static new MultiSet activeConnections;
static Map recentlyConnectedComputers = synchroMap(recenctlyConnectedComputers_internal);
static Var connected2 = new(0);
svoid updateValue {
Set set1 = keys(activeConnections);
Set set2 = keys(recentlyConnectedComputers);
int n = l(mergeSets(set1, set2));
//int n = l(connectedComputers);
connected2.set(n);
print("Updated value to " + n + " (" + l(set1) + "/" + l(set2) + ")");
// TODO (maybe): add countdown to ExpiringMap instead
doEvery(1000, r {
synchronized(recentlyConnectedComputers) {
recenctlyConnectedComputers_internal.clean();
}
});
}
html {
int count = parseIntOpt(params.get('count));
S computerID = or2(subBot_getHeader("X-ComputerID"), "unknown");
bool longPoll = params.get('count) != null;
if (!longPoll) ret connected2!;
temp tempAddToMultiSet(activeConnections, computerID);
temp tempAfterwards(r updateValue);
updateValue();
if (computerID != null) {
print("Got connection from " + computerID);
recentlyConnectedComputers.put(computerID, true);
}
print(connected2! + ", eq: " + eq(connected2!, count));
waitForVarToChange_withTimeout(connected2, count, timeout);
ret connected2!;
}