Hello, all. I'm currently debugging a really fun problem where the CBL framework fails to sync for a client in a corporate environment. I spent some time debugging, and I've tracked the issue down to the use of the SCNetworkReachability framework to decide whether to attempt to sync.
The problem is that the SCNetworkReachability library doesn't take proxy settings into consideration, so it attempts to resolve the host and verify that there is a valid path directly, which fails. So, in this particular environment, CBL never attempts to sync, even though the proxy should allow the sync to work correctly. So, I'm going to have to attempt to make this work somehow, and ideally whatever fix I make can be contributed back, so I'd like to make sure the approach I take is acceptable. So here's my proposal. In the absence of any proxy settings, the SCNetworkReachability check seems like the right thing to do, it just cannot be the final word when there is a proxy available. So, I think the right thing to do is to modify [CBLReachablity reachability] to be proxy-aware. My thinking is when the network state changes, the CBLReachability instance should ask the system if the given host would go through any proxies using CFNetworkCopyProxiesForURL. If there ARE proxies for that URL, it should make an immediate test request to the replication host with a relatively short timeout. It would treat any response other than a timeout as a positive reachability state, and a timeout as a negative reachability state. I'm not sure if the normal WiFi/Cellular flags can be trusted if SCNetworkReachablity says that the server is not accessible. If they cannot, I think that if the CBLReachabliity instance determined that the server was available via a proxy, it can assume that the phone is on WiFi and not cellular - I don't really see any other likely scenario where the phone would be behind a proxy like that. Does this make sense? Does anybody see any obvious problems with this? - Ian -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/4378872a-fe1d-46cc-b68d-c7aa7e7a3523%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
