~mdw
/
tripe
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e9ec939
)
svc/connect.in: Stash the time in a variable rather than fetching inline.
author
Mark Wooding
<mdw@distorted.org.uk>
Thu, 28 Apr 2022 14:12:54 +0000
(15:12 +0100)
committer
Mark Wooding
<mdw@distorted.org.uk>
Sat, 30 Apr 2022 00:51:38 +0000
(
01:51
+0100)
svc/connect.in
patch
|
blob
|
blame
|
history
diff --git
a/svc/connect.in
b/svc/connect.in
index
cec1e3f
..
1d34539
100644
(file)
--- a/
svc/connect.in
+++ b/
svc/connect.in
@@
-407,11
+407,12
@@
class PingPeer (object):
me._sigma_t = 0
me._sigma_t2 = 0
me._min = me._max = '-'
me._sigma_t = 0
me._sigma_t2 = 0
me._min = me._max = '-'
+ now = time()
if pingnow:
me._timer = None
me._ping()
else:
if pingnow:
me._timer = None
me._ping()
else:
- me._timer = M.SelTimer(
time()
+ me._every, me._time)
+ me._timer = M.SelTimer(
now
+ me._every, me._time)
def update(me, peer):
"""
def update(me, peer):
"""
@@
-441,13
+442,14
@@
class PingPeer (object):
me._peer]))
def _reconnect(me):
me._peer]))
def _reconnect(me):
+ now = time()
try:
peer = Peer(me._peer)
if me._connectp or me._knockp:
S.warn('connect', 'reconnecting', me._peer)
S.forcekx(me._peer, quiet = not me._knockp)
if me._connectp: T.spawn(run_connect, peer, peer.get('connect'))
try:
peer = Peer(me._peer)
if me._connectp or me._knockp:
S.warn('connect', 'reconnecting', me._peer)
S.forcekx(me._peer, quiet = not me._knockp)
if me._connectp: T.spawn(run_connect, peer, peer.get('connect'))
- me._timer = M.SelTimer(
time()
+ me._every, me._time)
+ me._timer = M.SelTimer(
now
+ me._every, me._time)
me._sabotage = False
else:
S.kill(me._peer)
me._sabotage = False
else:
S.kill(me._peer)
@@
-466,6
+468,7
@@
class PingPeer (object):
If the ping fails and we run out of retries, we attempt to restart the
connection.
"""
If the ping fails and we run out of retries, we attempt to restart the
connection.
"""
+ now = time()
if code == 'TIMER':
me._failures = 0
me._ping()
if code == 'TIMER':
me._failures = 0
me._ping()
@@
-487,7
+490,7
@@
class PingPeer (object):
me._nping += 1
if me._min == '-' or t < me._min: me._min = t
if me._max == '-' or t > me._max: me._max = t
me._nping += 1
if me._min == '-' or t < me._min: me._min = t
if me._max == '-' or t > me._max: me._max = t
- me._timer = M.SelTimer(
time()
+ me._every, me._time)
+ me._timer = M.SelTimer(
now
+ me._every, me._time)
elif outcome == 'ping-timeout':
me._failures += 1
me._nlost += 1
elif outcome == 'ping-timeout':
me._failures += 1
me._nlost += 1
@@
-862,6
+865,7
@@
def cmd_passive(*args):
Report a challenge; when (and if!) the server receives a greeting quoting
this challenge, add the corresponding peer to the server.
"""
Report a challenge; when (and if!) the server receives a greeting quoting
this challenge, add the corresponding peer to the server.
"""
+ now = time()
timeout = 30
op = T.OptParse(args, ['-timeout'])
for opt in op:
timeout = 30
op = T.OptParse(args, ['-timeout'])
for opt in op:
@@
-874,7
+878,7
@@
def cmd_passive(*args):
except KeyError: raise T.TripeJobError('unknown-peer', name)
chal = S.getchal()
cr = T.Coroutine.getcurrent()
except KeyError: raise T.TripeJobError('unknown-peer', name)
chal = S.getchal()
cr = T.Coroutine.getcurrent()
- timer = M.SelTimer(
time()
+ timeout, lambda: cr.switch(None))
+ timer = M.SelTimer(
now
+ timeout, lambda: cr.switch(None))
try:
T.svcinfo(chal)
chalmap[chal] = cr
try:
T.svcinfo(chal)
chalmap[chal] = cr