Skip to content

Commit

Permalink
Fixes #1000
Browse files Browse the repository at this point in the history
  • Loading branch information
borrrden committed Apr 18, 2018
1 parent f122902 commit fe1c302
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/Couchbase.Lite.Shared/Sync/WebSocketWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,19 @@ public void Start()
// STEP 2: Open the socket connection to the remote host
var cts = new CancellationTokenSource();
cts.CancelAfter(ConnectTimeout);
_client.ConnectAsync(_logic.UrlRequest.Host, _logic.UrlRequest.Port).ContinueWith(t =>
{
if (!NetworkTaskSuccessful(t)) {
return;
}
try {
_client.ConnectAsync(_logic.UrlRequest.Host, _logic.UrlRequest.Port).ContinueWith(t =>
{
if (!NetworkTaskSuccessful(t)) {
return;
}

_queue.DispatchAsync(StartInternal);
}, cts.Token);
_queue.DispatchAsync(StartInternal);
}, cts.Token);
} catch (Exception e) {
// Yes, unfortunately exceptions can either be thrown here or in the task...
DidClose(e);
}
});
}

Expand Down

0 comments on commit fe1c302

Please sign in to comment.