MYNetwork
MYNetwork copied to clipboard
MYDNSConnection -open creates retain loop?
The socket context makes the CFSocket retain and release its owner, why?
CFSocketContext ctxt = { 0, (__bridge void *)(self), CFRetain, CFRelease, NULL };
there should be no reason to do that, since you're invalidating and releasing the socket on dealloc. Creating the socket using the context like:
CFSocketContext ctxt = { 0, (__bridge void *)(self), NULL, NULL, NULL };
seems to work fine. This fixes the deadlock problem I was having, but I'm unsure as to whether the retain/release socket context is on purpose.
To be honest I can't remember why I did that. Taking out the retain/release would definitely fix the deadlock since the object wouldn't get dealloced on the internal socket thread anymore.
It sounds like you've made this change locally and have been running with it? If you are comfortable that it hasn't resulted in any crashes, let me know and I'll check it in.
It looks like this fixes an issue I had (presumably the same problem) where a bunch of threads would just end up spin-locking forever. Since it's been two weeks since the last message from @ghmrs356 about it, I'm gonna go ahead and put in the pull request.
Any movement on this?
All I can say is that it appears to work fine.