From dd4dee21c4efd2a2989cbe5b470386f787a893cd Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Thu, 21 May 2015 09:39:09 -0500 Subject: [PATCH] Move gethostbyname MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit don’t rely on Twisted to do this on packet write, just translate once when we read the config. --- dmrlink.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dmrlink.py b/dmrlink.py index ae1f398..632855a 100755 --- a/dmrlink.py +++ b/dmrlink.py @@ -31,6 +31,7 @@ from binascii import b2a_hex as h from hashlib import sha1 from socket import inet_ntoa as IPAddr from socket import inet_aton as IPHexStr +from socket import gethostbyname from twisted.internet.protocol import DatagramProtocol from twisted.internet import reactor from twisted.internet import task @@ -119,7 +120,7 @@ try: # Things we need to know to connect and be a peer in this IPSC 'RADIO_ID': hex(int(config.get(section, 'RADIO_ID')))[2:].rjust(8,'0').decode('hex'), - 'IP': config.get(section, 'IP'), + 'IP': gethostbyname(config.get(section, 'IP')), 'PORT': config.getint(section, 'PORT'), 'ALIVE_TIMER': config.getint(section, 'ALIVE_TIMER'), 'MAX_MISSED': config.getint(section, 'MAX_MISSED'),