various fixes
This commit is contained in:
parent
0ecc5877f2
commit
c511ec95eb
|
@ -43,8 +43,8 @@ except ImportError:
|
||||||
import DNS # http://pydns.sf.net/
|
import DNS # http://pydns.sf.net/
|
||||||
HAVE_PYDNS = True
|
HAVE_PYDNS = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
#TODO: use self.DEBUG()
|
#TODO: use self.DEBUG()
|
||||||
print "Couldn't load a supported DNS library. SRV records will not be queried and you may need to set custom hostname/port for some servers to be accessible."
|
print "Could not load a supported DNS library. SRV records will not be queried and you may need to set custom hostname/port for some servers to be accessible."
|
||||||
|
|
||||||
DATA_RECEIVED='DATA RECEIVED'
|
DATA_RECEIVED='DATA RECEIVED'
|
||||||
DATA_SENT='DATA SENT'
|
DATA_SENT='DATA SENT'
|
||||||
|
@ -82,16 +82,19 @@ class TCPsocket(PlugIn):
|
||||||
port = int (answers[0].port)
|
port = int (answers[0].port)
|
||||||
break
|
break
|
||||||
elif HAVE_PYDNS:
|
elif HAVE_PYDNS:
|
||||||
DNS.ParseResolvConf() # ensure we haven't cached an old configuration
|
# ensure we haven't cached an old configuration
|
||||||
|
DNS.ParseResolvConf()
|
||||||
response = DNS.Request().req(query, qtype='SRV')
|
response = DNS.Request().req(query, qtype='SRV')
|
||||||
answers = response.answers
|
answers = response.answers
|
||||||
if len(answers) > 0:
|
if len(answers) > 0:
|
||||||
_, _, port, host = answers[0]['data'] # ignore the priority and weight for now
|
# ignore the priority and weight for now
|
||||||
|
_, _, port, host = answers[0]['data']
|
||||||
|
del _
|
||||||
port = int(port)
|
port = int(port)
|
||||||
break
|
break
|
||||||
except:
|
except:
|
||||||
#TODO: use self.DEBUG()
|
#TODO: use self.DEBUG()
|
||||||
print 'An error occurred looking up %s' % query
|
print 'An error occurred while looking up %s' % query
|
||||||
server = (host, port)
|
server = (host, port)
|
||||||
# end of SRV resolver
|
# end of SRV resolver
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue