;
; Self pings
;
raw 421:& *§ *:{
if ($hget(pnp. $+ $cid,-sp. $+ $round($2,0))) {
hadd pnp. $+ $cid -self.ticks $calc($ticks - $ifmatch)
hadd pnp. $+ $cid -self.lag $_dur($calc(($ticks - $ifmatch) / 1000))
}
else { hdel -w pnp. $+ $cid -sp.* | .timer -m 1 0 _qsp | halt }
if (R isin $2) disp Self-Ping of $:s($hget(pnp. $+ $cid,-self.lag))
if ($round($2,0) == $hget(pnp. $+ $cid,-sp.index)) hdel -w pnp. $+ $cid -sp.*
else hdel pnp. $+ $cid -sp. $+ $round($2,0)
if ($_cfgi(sptime)) {
; next one is half as soon if we're lagged
if ($hget(pnp. $+ $cid,-self.ticks) > 20000) .timer.selfping. $+ $cid 1 $calc($_cfgi(sptime) / 2) _qsp
else .timer.selfping. $+ $cid 1 $_cfgi(sptime) _qsp
_upd.title
}
else {
.timer.selfping. $+ $cid 0 99 if ($_cfgi(sptime)) _qsp
hdel pnp. $+ $cid -self.*
}
.timer.selfwarn?. $+ $cid off
.timer.selflagup. $+ $cid off
hdel pnp. $+ $cid -sp.count
.signal PNP.SELFPING $hget(pnp. $+ $cid,-self.ticks) $hget(pnp. $+ $cid,-self.lag)
halt
}
alias ps sp
alias sp _notconnected (self-ping) | _qsp R | disp Self-Ping...
alias _qsp {
hinc pnp. $+ $cid -sp.index
hadd pnp. $+ $cid -sp. $+ $hget(pnp. $+ $cid,-sp.index) $ticks
$hget(pnp. $+ $cid,-sp.index) $+ $1 $+ §
if ($_cfgi(sptime)) .timer.selfping. $+ $cid 1 $int($calc($ifmatch * 1.5)) _qsp X
else {
.timer.selfping. $+ $cid 0 99 if ($_cfgi(sptime)) _qsp
hdel pnp. $+ $cid -self.*
}
if (X !isin $1) {
if ($_cfgi(spwarn1) isnum) if ($ifmatch > 0) .timer.selfwarn1. $+ $cid 1 $ifmatch _alert Self-lag Warning- Over $:b($ifmatch) sec lag to self!
if ($_cfgi(spwarn2) isnum) if ($ifmatch > 0) .timer.selfwarn2. $+ $cid 1 $ifmatch _alert Self-lag Warning- Over $:b($ifmatch) sec lag to self!
hadd pnp. $+ $cid -sp.count 0
.timer.selflagup. $+ $cid -c 0 1 hinc pnp. $+ $cid -sp.count $chr(124) hadd pnp. $+ $cid -self.lag $!hget(pnp. $+ $cid $+ ,-sp.count) $!+ + s $chr(124) hadd pnp. $+ $cid -self.ticks $!calc(1000 * $!hget(pnp. $+ $cid $+ ,-sp.count))
}
}
raw 1:*:if ($_cfgi(sptime)) { .timer.selfping. $+ $cid 1 $ifmatch _qsp | hdel pnp. $+ $cid -self.ticks | hadd pnp. $+ $cid -self.lag ?? s } | else .timer.selfping 0 99 if ($_cfgi(sptime)) _qsp
|