Skip to content

Commit 86994d1

Browse files
author
duanhongyi
committed
fix(tcp): fix tcp error
1 parent 15b6a28 commit 86994d1

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

smartdns/dnsserver.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,12 @@ def handleQuery(self, message, protocol, address):
181181
cliAddr = address
182182
if query.type == 43 or typeToMethod[query.type] == 'lookupAllRecords':
183183
return [(),(),()]
184-
if typeToMethod[query.type] in smartType and \
184+
if isinstance(protocol, dns.DNSProtocol):
185+
cliAddr = protocol.transport.client
186+
elif typeToMethod[query.type] in smartType and \
185187
len(message.additional) != 0 and \
186-
message.additional[0].type == 41 \
187-
and message.additional[0].rdlength > 8:
188+
message.additional[0].type == 41 and \
189+
message.additional[0].rdlength > 8:
188190
cliAddr = (message.additional[0].payload.dottedQuad(), 0)
189191
edns = message.additional[0]
190192
return self.resolver.query(query, addr = cliAddr, edns = edns).addCallback(

0 commit comments

Comments
 (0)