hbc from wig

This commit is contained in:
2016-04-22 08:00:18 +02:00
+13 -3
View File
@@ -26,10 +26,12 @@ except:
require on Linux
python-filelock
python-daemon vs 1.61 or >
run sudo easy_install-2.7 lockfile python-daemon
on *bsd
py27-lockfile
py27-daemon
or run sudo easy_install-2.7 lockfile python-daemon"""
run sudo pkg install -y py27-lockfile py27-daemon
"""
sys.exit(1)
import syslog
@@ -43,6 +45,7 @@ MAXRECV = 32767
running = True
dorestart = False
warned1 = False
class NullDevice:
def write(self, s):
@@ -66,6 +69,8 @@ class Conn:
self.sock.getsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR) | 1)
def sendto(self, msg, ID = 'HTB'): # default ID is HearTBeat
global warned1
msg['name'] = iam
msg['id'] = self.conId
msg['ver'] = VER
@@ -73,7 +78,12 @@ class Conn:
m = dicttos(ID, msg)
mz = zlib.compress(m,9)
if verbose: print "conn.send('%s', (%s:%s) %s>%s)" % (msg, self.addr, self.port, len(m), len(mz))
self.sock.sendto(m, (self.addr, self.port))
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)
warned1 = True
return
self.send += 1
self.lastsend = time.time()
@@ -468,7 +478,7 @@ if fdaemon:
working_directory='/tmp',
umask=0o002,
pidfile=pidfile,
initgroups=False,
# initgroups=False,
)
context.signal_map = {