yaxim-org / yaxim

yaxim - a lean XMPP/Jabber client for Android
https://yaxim.org
GNU General Public License v3.0
486 stars 238 forks source link

Support RFC-6555: Happy Eyeballs (IPv6/4 dualstack) #164

Open da2x opened 9 years ago

da2x commented 9 years ago
  1. Setup example.com with unresponsive AAAA and working A
  2. Connect to example.com from a IPv6 capable network

yaxim tries to connect to AAAA for about a minute and then fails completely (ETIMEOUT). Retries the AAAA connection after an interval.

RFC-6555 says to:

  1. Lookup both AAAA and A records
  2. Connect to both and use whichever connection is established the fastest and to drop the unused connection

IPv6 will, unfortunately, continue to be a source of inexplainable problems for users for a long time. RFC-6555 is important because networks often are broken.

An alternative implementation (popular before RFC-6555):

  1. Lookup DNS records
  2. Try connecting to first record (AAAA or A) for 120 seconds until a connection is established
  3. Try connecting to second record (AAAA or A) for 120 seconds until a connection is established 4 . …

This should be easier to implement.

I can’t say I’ve had many IPv6 problems with any app on Android other than some third-party calendar plug-ins.

ge0rg commented 9 years ago

This is an interesting issue. I suppose what you are seeing here is a bug in Android's Java runtime implementation. Neither yaxim nor smack (the underlying XMPP library) do resolve AAAA or A records, they only obtain the SRV record for the XMPP service, and then let the Java runtime connect to the given hostname.

I remember I saw this issue on older Android releases, but I really hoped they would have nailed it by now. I suppose I need to bring that up on the smack issue tracker and see if we want to create a workaround. And then, I need to use the newest version of smack in yaxim. Until all of this happens, IPv4 is probably deprecated ;-)