juhovh / shairplay

Apple airplay and raop protocol server
Other
1.35k stars 228 forks source link

Strange behaviour with iOS 7.1 client - no connection possible #23

Closed Memphiz closed 10 years ago

Memphiz commented 10 years ago

Based on a user report here:

http://forum.xbmc.org/showthread.php?tid=189970

There might be problems where an ios client from music app (7.1 in his case) tries to connect both on ipv4 and ipv6. In that case the connection gets refused. See shairplay printouts here:

http://pastebin.com/g9Tp5X6g

Would be great if you have a quick idea on how to fix that one.

juhovh commented 10 years ago

This seems like a bug, from shairplay src/lib/httpd.c:

        if (i == httpd->max_connections) {
                /* This code should never be reached, we do not select server_fds when full */
                logger_log(httpd->logger, LOGGER_INFO, "Max connections reached");
                shutdown(fd, SHUT_RDWR);
                closesocket(fd);
                return;
        }

Weird, I'm looking at it right now, let's hope I figure this out since I haven't been able to reproduce. It is known that iOS sometimes does some connection probing (multiple connections with IPv4/IPv6 to check which works) but shairplay should be able to handle this correctly.

juhovh commented 10 years ago

There was a race condition if IPv4 and IPv6 connections came at the same time. This was made a bit worse with XBMC configured to only accept one connection at the time. Hopefully this should fix the issue, now shairplay waits until the IPv4 connection is closed before accepting the IPv6 connection.

Memphiz commented 10 years ago

thx will let the user test it :)

Memphiz commented 10 years ago

Not good yet:

http://pastebin.com/sXvyVzrd

juhovh commented 10 years ago

From my point of view the original problem is fixed now, because both IPv4 and IPv6 connections get processes correctly.

The pair-verify and pair-setup problem is a separate issue. Actually this is the first time I see it, googled around and it seems to be related to DRM: http://stackoverflow.com/questions/20845353/errors-with-airplay-on-embedded-iframe-youtube-videos-in-uiwebview

I suspect this has something to do with you advertising fairplay capabilities in mDNS in order to get videos working... But cannot be sure.

juhovh commented 10 years ago

It looks as if Apple has rolled out some new feature kn Airplay and it has causes trouble for Apple customers as well... https://discussions.apple.com/message/24213491#24213491

Memphiz commented 10 years ago

I don't announce fairplay support - our mdns announce was not changed for the ios7 fix at all - thx for the infos.

juhovh commented 10 years ago

Oh, I assumed something was changed because you added the fp-setup... I have iOS7.1 myself and I haven't had problems with audio support since iOS6. If it's not the mDNS then it probably has something to do with the content the user is sending. Keep me updated if you get any info about how to reproduce.

Memphiz commented 10 years ago

New comment from the user who reported this:

http://forum.xbmc.org/showthread.php?tid=189970&pid=1666337#pid1666337