Skip to content

Instantly share code, notes, and snippets.

View mccarron's full-sized avatar

Patrick McCarron mccarron

View GitHub Profile
@mccarron
mccarron / iTunesOpenConnectionLog
Created August 21, 2012 15:36
iTunes Home Sharing Connection Leaking Testing
For last month or so I have to restart iTunes on my desktop every day or so in order to get the AppleTV to connect to it. I've seen a lot of different people online having this problem, and a lot of different solutions. The core issue for me is it does in fact seem that iTunes does not close connections to the Apple TV which makes it unable to accept anymore from any other Apple TV in the house.
After reading a few comments on a Apple Discussion thread (https://discussions.apple.com/thread/3959358?start=30&tstart=0) I'm trying a few different things to see what solves my problem until Apple fixes the glitch. Once I find out more and have a way to easily reproduce it, I'll file a bug with Apple.
Some solutions have said to do all or some the following:
- Tell AppleTV to never sleep
- Set Apple TV to a static IP or a longer DHCP renew time
- Use WiFi not Ethernet
Command to see open connections for iTunes: lsof -i | grep iTunes
// This sqlite3_exec limits the database to 50 DB pages (about 1.5Kb each)
// Huge memory win on iPhone.
if(sqlite3_exec(myDatabsae, "PRAGMA CACHE_SIZE=50", NULL, NULL, NULL) != SQLITE_OK)
NSLog(@"Couldn't set cache size: %s", sqlite3_errmsg([self.database sql]));