Move gethostbyname

don’t rely on Twisted to do this on packet write, just translate once
when we read the config.
This commit is contained in:
Cort Buffington 2015-05-21 09:39:09 -05:00
parent d4b51fd08f
commit dd4dee21c4
1 changed files with 2 additions and 1 deletions

View File

@ -31,6 +31,7 @@ from binascii import b2a_hex as h
from hashlib import sha1 from hashlib import sha1
from socket import inet_ntoa as IPAddr from socket import inet_ntoa as IPAddr
from socket import inet_aton as IPHexStr from socket import inet_aton as IPHexStr
from socket import gethostbyname
from twisted.internet.protocol import DatagramProtocol from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor from twisted.internet import reactor
from twisted.internet import task from twisted.internet import task
@ -119,7 +120,7 @@ try:
# Things we need to know to connect and be a peer in this IPSC # 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'), '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'), 'PORT': config.getint(section, 'PORT'),
'ALIVE_TIMER': config.getint(section, 'ALIVE_TIMER'), 'ALIVE_TIMER': config.getint(section, 'ALIVE_TIMER'),
'MAX_MISSED': config.getint(section, 'MAX_MISSED'), 'MAX_MISSED': config.getint(section, 'MAX_MISSED'),