fix for dropped pkts on Linux
This commit is contained in:
@@ -99,7 +99,7 @@ class Conn:
|
||||
try:
|
||||
self.sock.sendto(m, (self.addr, self.port))
|
||||
except socket.error as e:
|
||||
if not warned1: print "socket error: %s %s:%s" % (e, self.addr, self.port)
|
||||
if not warned1: log("socket error: %s %s:%s" % (e, self.addr, self.port))
|
||||
warned1 = True
|
||||
return
|
||||
self.send += 1
|
||||
@@ -295,7 +295,7 @@ def process():
|
||||
running = False
|
||||
break
|
||||
except SystemExit:
|
||||
log('daemon exit, running=: %s' % running)
|
||||
log('daemon exit, running was %s' % running)
|
||||
if running:
|
||||
running = False
|
||||
break
|
||||
@@ -327,9 +327,12 @@ def process():
|
||||
if not running:
|
||||
break
|
||||
for conn in conns:
|
||||
# msg={'interval': interval, 'acks': conns[conn].ackcount, 'rtt': conns[conn].rtts[-1]}
|
||||
msg={'acks': conns[conn].ackcount, 'rtt': conns[conn].rtts[-1]}
|
||||
conns[conn].sendto(msg)
|
||||
time.sleep(0.1) #N.B. Linux (i.e. Rasperry Pi 3 drops the second pkg unless delayed
|
||||
if nextReport + interval >= time.time():
|
||||
nextReport += interval
|
||||
else:
|
||||
nextReport = time.time() + interval
|
||||
|
||||
if verbose: log( "process: done running")
|
||||
@@ -472,11 +475,11 @@ if not msgonly:
|
||||
|
||||
conns = {}
|
||||
while True:
|
||||
log(" create connections")
|
||||
if verbose: log("create connections")
|
||||
createConnections(hb_hosts)
|
||||
if len(conns) != 0:
|
||||
break
|
||||
log(" no connections yet, sleep a bit")
|
||||
if verbose: log("no connections yet, sleep a bit")
|
||||
time.sleep(2)
|
||||
|
||||
if verbose:
|
||||
|
||||
Reference in New Issue
Block a user