From 9aebf28023ad92639e8c73841395bcd3ed454479 Mon Sep 17 00:00:00 2001 From: Jim Borden Date: Sun, 28 Oct 2018 08:43:14 +0900 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20allow=20reachability=20for=20P2?= =?UTF-8?q?P=20/=20loopback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit P2P may not need it, and loopback doesn’t make sense on iOS --- src/Couchbase.Lite.Shared/API/Sync/Replicator.cs | 7 ++++++- .../iOS/Support/iOSReachability.cs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Couchbase.Lite.Shared/API/Sync/Replicator.cs b/src/Couchbase.Lite.Shared/API/Sync/Replicator.cs index d7fa54a98..24de00c86 100644 --- a/src/Couchbase.Lite.Shared/API/Sync/Replicator.cs +++ b/src/Couchbase.Lite.Shared/API/Sync/Replicator.cs @@ -484,9 +484,14 @@ private void StartReachabilityObserver() return; } + var remoteUrl = (Config.Target as URLEndpoint)?.Url; + if(remoteUrl == null) { + return; + } + _reachability = Service.GetInstance() ?? new Reachability(); _reachability.StatusChanged += ReachabilityChanged; - _reachability.Url = Config.RemoteUrl; + _reachability.Url = remoteUrl; _reachability.Start(); } diff --git a/src/Couchbase.Lite.Support.Apple/iOS/Support/iOSReachability.cs b/src/Couchbase.Lite.Support.Apple/iOS/Support/iOSReachability.cs index 8133a27bb..1f297de9f 100644 --- a/src/Couchbase.Lite.Support.Apple/iOS/Support/iOSReachability.cs +++ b/src/Couchbase.Lite.Support.Apple/iOS/Support/iOSReachability.cs @@ -104,7 +104,7 @@ public void Start() { _queue.DispatchSync(() => { - if (_started) { + if (_started || Url?.IsLoopback == true) { return; }