2019-08-26 Fred Gleason <fredg@paravelsystems.com>

* Fixed a bug in the 'pypad_udp.py' PyPAD script that caused
	an infinite loop.
This commit is contained in:
Fred Gleason
2019-08-27 18:33:57 -04:00
parent 88bebdecc4
commit 22b9679783
2 changed files with 14 additions and 10 deletions

View File

@@ -4,7 +4,7 @@
#
# Send PAD updates via UDP
#
# (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
# (C) Copyright 2018-2019 Fred Gleason <fredg@paravelsystems.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@@ -30,16 +30,17 @@ def eprint(*args,**kwargs):
def ProcessPad(update):
n=1
while(True):
section='Udp'+str(n)
while(update.config().has_section(section)):
if update.shouldBeProcessed(section):
fmtstr=update.config().get(section,'FormatString')
send_sock.sendto(update.resolvePadFields(fmtstr,int(update.config().get(section,'Encoding'))).encode('utf-8'),
(update.config().get(section,'IpAddress'),int(update.config().get(section,'UdpPort'))))
n=n+1
section='Udp'+str(n)
try:
if update.shouldBeProcessed(section):
fmtstr=update.config().get(section,'FormatString')
send_sock.sendto(update.resolvePadFields(fmtstr,int(update.config().get(section,'Encoding'))).encode('utf-8'),
(update.config().get(section,'IpAddress'),int(update.config().get(section,'UdpPort'))))
n=n+1
except configparser.NoSectionError:
return
if(n==1):
update.syslog(syslog.LOG_WARNING,'No UDP config found')
#
# 'Main' function