Skip to content

Commit

Permalink
Merge pull request #56 from liverpoolfc-fan/Duplicate-Pings-With-Same…
Browse files Browse the repository at this point in the history
…-Timestamp

Duplicate-Pings-With-Same-Timestamp
  • Loading branch information
matidau authored Apr 29, 2024
2 parents dc9d730 + c945550 commit 4a7850b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib/core/pingtracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,16 @@ public function DoForcePingTimeout() {
// check if there is another (and newer) active ping connection
if (is_array($pings) && isset($pings[self::$devid][self::$user]) && count($pings[self::$devid][self::$user]) > 1) {
foreach ($pings[self::$devid][self::$user] as $pid=>$starttime)
if ($starttime > self::$start)
if ($starttime > self::$start) {
return true;
}
elseif ($starttime == self::$start) {
// Arbitrary decision to differentiate multiple processes that started at the same second for the same user. Compare PIDs
// If the other process has a bigger PID then kill this process
if ($pid > self::$pid) {
return true;
}
}
}

return false;
Expand Down

0 comments on commit 4a7850b

Please sign in to comment.