On 03:24 am, z858570...@gmail.com wrote:
when i run the code:
df = Deferred()
name = Name('version.bind')
axf = AXFRController(name,df)
dns = DNSDatagramProtocol(axf)
d = dns.query((ip,53),[Query('version.bind',TXT,CH)])
it raise the error :
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/twisted/python/log.py",
line
73, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib/python2.7/site-
packages/twisted/python/context.py",
line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib/python2.7/site-
packages/twisted/python/context.py",
line 81, in callWithContext
return func(*args,**kw)
File
"/usr/local/lib/python2.7/site-packages/twisted/internet/posixbase.py",
line 614, in _doReadOrWrite
why = selectable.doRead()
--- <exception caught here> ---
File "/usr/local/lib/python2.7/site-packages/twisted/internet/udp.py",
line 149, in doRead
self.protocol.datagramReceived(data, addr)
File "/usr/local/lib/python2.7/site-packages/twisted/names/dns.py",
line
1936, in datagramReceived
self.controller.messageReceived(m, self, addr)
exceptions.TypeError: messageReceived() takes exactly 3 arguments (4
given)
Unhandled Error
and the I set the DNSDatagramProtocol.datagramReceived's last row
self.controller.messageReceived(m, self, addr)
to
self.controller.messageReceived(m, self)
it'ok!
And this is a bug????
Hello,
I tried turning your code into an <http://sscce.org/>:
from __future__ import print_function
from twisted.internet.defer import Deferred
from twisted.names.dns import TXT, CH, Name, Query,
DNSDatagramProtocol
from twisted.names.client import AXFRController
from twisted.internet.task import react
def main(reactor):
ip = '8.8.8.8'
df = Deferred()
name = Name('version.bind')
axf = AXFRController(name,df)
dns = DNSDatagramProtocol(axf)
d = dns.query((ip,53),[Query('version.bind',TXT,CH)])
d.addCallback(print)
return d
react(main, [])
But I wasn't able to reproduce the error you encountered, instead I get
the output:
<twisted.names.dns.Message instance at 0x18642d8>
Perhaps the error has something to do with how the DNS server responds.
If so, can you expand this minimal example to include a server that
sends a response that triggers the bug (Twisted Names itself can be used
as such a server, or you could hard-code the response you're seeing
locally)? Alternatively if you could turn this into a unit test that
doesn't actually interact with a network, that would also be great.
Thanks,
Jean-Paul
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python