NSLogger
NSLogger copied to clipboard
weird error with bonjour connections
I have the following scenario with an app running on an iPhone.
I'm using the following setup:
LoggerSetOptions(NULL, kLoggerOption_BufferLogsUntilConnection | kLoggerOption_BrowseBonjour); NSString *logBufferPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"bb.rawnsloggerdata"]; LoggerSetBufferFile(NULL, (__bridge CFStringRef)logBufferPath);
Everything works fine if I start up the app with my iphone on wifi. It doesn't work properly if I disconnect from wifi and then reconnect OR if I start the app disconnected from wifi and then reconnect.
If I enable debugging in the NSLogger code, I see errors in the LoggerServiceBrowserCallback.
Logger configured to search all domains, browsing for domains first LoggerStartBonjourBrowsing Logger configured to search all domains, browsing for domains first LoggerServiceBrowserCallback browser=<CFNetServiceBrowser 0x101ca390 [0x3f9de650]> flags=0x0002 domainOrService=local. error=0 Logger started search for services of type _nslogger._tcp in domain local. LoggerServiceBrowserCallback browser=<CFNetServiceBrowser 0x488b30 [0x3f9de650]> flags=0x0002 domainOrService=local. error=0 Logger started search for services of type _nslogger._tcp in domain local. // Everything working fine here
// Now I disconnect and reconnect to wifi LoggerServiceBrowserCallback browser=<CFNetServiceBrowser 0x101b5fe0 [0x3f9de650]> flags=0x0000 domainOrService=(null) error=-72000 Logger found service: (null) LoggerServiceBrowserCallback browser=<CFNetServiceBrowser 0x101ea8f0 [0x3f9de650]> flags=0x0000 domainOrService=(null) error=-72000 Logger found service: (null)
I tried configuring with a Bonjour service name and without.
Jason
The error is "normal" in that the Bonjour lookup comes back with a kCFNetServiceErrorUnknown (-72000). I think this is more an issue with the logic in the NSLogger client code that fails restarting the Bonjour lookup. I have already seen this issue but never investigated it. Will have a look when I have some time, unless you'd be kind enough to look into it?
It's been a while, but I finally rewrote the reconnection logic. It is now much more resilient and you should have better results with 1.5-beta (master as of today).
I'm getting the same error now on Yosemite (along with 145% use of my CPU!). I haven't looked at running from Xcode yet, I've been using the 1.5 desktop release from Sept 9 :)
Ouch that's annoying. I have not run extensive tests from Yosemite client (I'm using NSLogger mostly from iOS and Android) but will do. Thanks for the heads up !