twisted.names.dns: DNSDatagramProtocol doesn't release unused UDP-ports
|Reported by:||pittipatti||Owned by:|
In class "DNSDatagramProtocol" the function "startListening" attaches a UDP-port to the reactor, but leaves it attached even when the protocol is closed.
In my application I have to create new resolvers for querying many different nameservers.
Please have a look at the attachments with sample code which results
- in many listening UDP-ports ( please see in another console: netstat -anpu | grep python )
- in a (rather strange) exception (ImportError: cannot import name SHA)
As mentioned above, DNSDatagramProtocol.startListening() executes reactor.listenUDP, but the returned port isn't saved anywere, so it can't be closed. I saved it as a instance-variable but have no clue where to call the stopListening()-function, since DNSDatagramProtocol.stopProtocol() or DNSDatagramProtocol.doStop() don't seem to be called at all.