id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,branch,branch_author,launchpad_bug
4212,Twisted names gives the wrong address family.,ali,,"I don't pretend to understand this too well, but:

{{{
from twisted.internet import reactor, ssl
from twisted.words.protocols import irc
from twisted.internet.protocol import ClientFactory

from twisted.names import client
reactor.installResolver(client.createResolver())

class Bot(irc.IRCClient):
    nickname = 'screwytestcase'

    def signedOn(self):
        print 'Signed On'

class BotFac(ClientFactory):
    protocol = Bot

    def clientConnectionFailed(self, connector, reason):
        print 'Failed', connector, reason


f = BotFac()
reactor.connectSSL(""testnet.freenode.net"", 9003, f, ssl.ClientContextFactory())
reactor.run()
}}}

gives

{{{
Failed <twisted.internet.ssl.Connector instance at 0x99114ec> [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectError'>: An error occurred while connecting: -9: Unknown error 4294967287.
}}}

According to exarkun

{{{
19:58 < exarkun> aa_: testnet.freenode.net has some AAAA records and some A records
19:58 < exarkun> aa_: Seems like Twisted Names will give you back an AAAA record from getHostByName, if it happens to be first
                 in the response
19:59 < exarkun> aa_: which sometimes it will be, because servers like to jumble up the order
19:59 < exarkun> socket.gaierror: [Errno -9] Address family for hostname not supported
20:00 < exarkun> That's some bad error handling on our part; -9 isn't a real errno, but gaierror tricks us into thinking it is.
}}}",defect,new,normal,,names,,,,,,
