When an XMPP server has SRV records, try them, but don't then fall back to the regular host if they all fail.
gmail.com has some XMPP SRV records, but does not itself respond to XMPP traffic, although it does accept connections on port 5222. So if a user entered the wrong password, it would try all the SRVs and fall back to trying gmail, and hang at that point. This seems the right thing to do, not just a workaround.
This commit is contained in:
parent
4c164c8c70
commit
780efc775c
2 changed files with 8 additions and 3 deletions
|
@ -34,17 +34,20 @@ connectXMPP c a = case parseJID (xmppJID c) of
|
|||
|
||||
{- Do a SRV lookup, but if it fails, fall back to the cached xmppHostname. -}
|
||||
connectXMPP' :: JID -> XMPPCreds -> (JID -> XMPP a) -> IO [(HostPort, Either SomeException ())]
|
||||
connectXMPP' jid c a = reverse <$> (go [] =<< lookupSRV srvrecord)
|
||||
connectXMPP' jid c a = reverse <$> (handle =<< lookupSRV srvrecord)
|
||||
where
|
||||
srvrecord = mkSRVTcp "xmpp-client" $
|
||||
T.unpack $ strDomain $ jidDomain jid
|
||||
serverjid = JID Nothing (jidDomain jid) Nothing
|
||||
|
||||
go l [] = do
|
||||
handle [] = do
|
||||
let h = xmppHostname c
|
||||
let p = PortNumber $ fromIntegral $ xmppPort c
|
||||
r <- run h p $ a jid
|
||||
return (r : l)
|
||||
return [r]
|
||||
handle srvs = go [] srvs
|
||||
|
||||
go l [] = return l
|
||||
go l ((h,p):rest) = do
|
||||
{- Try each SRV record in turn, until one connects,
|
||||
- at which point the MVar will be full. -}
|
||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -28,6 +28,8 @@ git-annex (4.20130710) UNRELEASED; urgency=low
|
|||
* Bug fix: Adding files that contained a tarball of a git-annex repository,
|
||||
or other content in the first line that looks like a git-annex link,
|
||||
could cause git-annex add to malfunction and lose the file content.
|
||||
* When an XMPP server has SRV records, try them, but don't then fall
|
||||
back to the regular host if they all fail.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Tue, 09 Jul 2013 19:17:13 -0400
|
||||
|
||||
|
|
Loading…
Reference in a new issue