mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-30 17:23:53 +01:00
2019-01-05 Fred Gleason <fredg@paravelsystems.com>
* Added keep-alive packet support to the 'pypad_ando.py' PyPAD script.
This commit is contained in:
@@ -30,6 +30,17 @@ last_updates={}
|
||||
def eprint(*args,**kwargs):
|
||||
print(*args,file=sys.stderr,**kwargs)
|
||||
|
||||
def ProcessTimer(config):
|
||||
n=1
|
||||
while(True):
|
||||
section='System'+str(n)
|
||||
try:
|
||||
send_sock.sendto('HB'.encode('utf-8'),
|
||||
(config.get(section,'IpAddress'),int(config.get(section,'UdpPort'))))
|
||||
n=n+1
|
||||
except configparser.NoSectionError:
|
||||
return
|
||||
|
||||
def ProcessPad(update):
|
||||
try:
|
||||
last_updates[update.machine()]
|
||||
@@ -73,4 +84,5 @@ except IndexError:
|
||||
eprint('pypad_ando.py: you must specify a configuration file')
|
||||
sys.exit(1)
|
||||
rcvr.setCallback(ProcessPad)
|
||||
rcvr.setTimerCallback(30,ProcessTimer)
|
||||
rcvr.start(sys.argv[1],int(sys.argv[2]))
|
||||
|
||||
Reference in New Issue
Block a user