file->open and clean debug statements

This commit is contained in:
2019-12-16 12:20:43 -05:00
parent 43910bd3c4
commit 7cf8f16dcf
2 changed files with 5 additions and 6 deletions
+4 -5
View File
@@ -94,7 +94,6 @@ class Conn:
return return
self.send += 1 self.send += 1
self.lastsend = msg['time'] self.lastsend = msg['time']
print("RTT self.lastsend %s" % self.lastsend)
def ack(self, msgDict, now): def ack(self, msgDict, now):
@@ -155,7 +154,7 @@ def stodict(msg):
if v[0].isdigit(): if v[0].isdigit():
v = eval(v) v = eval(v)
d[k] = v d[k] = v
print("DBG: msg is %s" % d) if verbose: print("DBG: msg is %s" % d)
return d return d
@@ -417,9 +416,9 @@ def daemonize(working_dir="/", stdin='/dev/zero', stdout='/dev/null', stderr='/d
# redirects standard file descriptors # redirects standard file descriptors
sys.stdout.flush() sys.stdout.flush()
sys.stderr.flush() sys.stderr.flush()
si = file(stdin, 'r') si = open(stdin, 'r')
so = file(stdout, 'a+') so = open(stdout, 'a+')
se = file(stderr, 'a+', 0) se = open(stderr, 'a+')
os.dup2(si.fileno(), sys.stdin.fileno()) os.dup2(si.fileno(), sys.stdin.fileno())
os.dup2(so.fileno(), sys.stdout.fileno()) os.dup2(so.fileno(), sys.stdout.fileno())
os.dup2(se.fileno(), sys.stderr.fileno()) os.dup2(se.fileno(), sys.stderr.fileno())
+1 -1
View File
@@ -2,7 +2,7 @@
# $Id: hbd,v 1.38 2013/07/14 02:25:05 andreas Exp $ # $Id: hbd,v 1.38 2013/07/14 02:25:05 andreas Exp $
# Wait for heartbeat messages and act on them (or their absence) # Wait for heartbeat messages and act on them (or their absence)
# #
VER = 3.00 VER = 4.00
import time import time
import os import os