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