Skip to content
This repository was archived by the owner on Mar 10, 2022. It is now read-only.

Commit 9ddafca

Browse files
committed
Use WebSocketCloseUserTransient and Uset WebSocketCloseUserPermanent
* Used WebSocketCloseUserTransient and WebSocketCloseUserPermanent error codes to represent recoverable and non-recoverable MessagingError. * Updated LiteCore
1 parent 410cccb commit 9ddafca

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

shared/src/main/java/com/couchbase/lite/AbstractReplicator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
import static com.couchbase.litecore.C4ReplicatorStatus.C4ReplicatorActivityLevel.kC4Connecting;
5151
import static com.couchbase.litecore.C4ReplicatorStatus.C4ReplicatorActivityLevel.kC4Offline;
5252
import static com.couchbase.litecore.C4ReplicatorStatus.C4ReplicatorActivityLevel.kC4Stopped;
53-
import static com.couchbase.litecore.C4WebSocketCloseCode.kWebSocketCloseCustomTransient;
53+
import static com.couchbase.litecore.C4WebSocketCloseCode.kWebSocketCloseUserTransient;
5454
import static java.util.Collections.synchronizedSet;
5555

5656
/**
@@ -620,7 +620,7 @@ private boolean handleError(C4Error c4err) {
620620
// in network (i.e. network down, hostname unknown), then go offline and retry later.
621621
boolean bTransient = C4Replicator.mayBeTransient(c4err) ||
622622
(c4err.getDomain() == WebSocketDomain &&
623-
c4err.getCode() == kWebSocketCloseCustomTransient);
623+
c4err.getCode() == kWebSocketCloseUserTransient);
624624

625625
boolean bNetworkDependent = C4Replicator.mayBeNetworkDependent(c4err);
626626
if (!bTransient && !(config.isContinuous() && bNetworkDependent))

shared/src/main/java/com/couchbase/lite/CBLError.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,17 @@ interface Code {
8888
int CBLErrorHTTPNotImplemented = 10501; // Unimplemented server functionality
8989
int CBLErrorHTTPServiceUnavailable = 10503; // Service is down temporarily(?)
9090

91-
int CBLErrorWebSocketBase = 11000; // ---- WebSocket status codes start here
92-
int CBLErrorWebSocketGoingAway = 11001; // Peer has to close, e.g. because host app is quitting
93-
int CBLErrorWebSocketProtocolError = 11002; // Protocol violation: invalid framing data
94-
int CBLErrorWebSocketDataError = 11003; // Message payload cannot be handled
95-
int CBLErrorWebSocketAbnormalClose = 11006; // TCP socket closed unexpectedly
96-
int CBLErrorWebSocketBadMessageFormat = 11007; // Unparseable WebSocket message
97-
int CBLErrorWebSocketPolicyError = 11008; // Message violated unspecified policy
98-
int CBLErrorWebSocketMessageTooBig = 11009; // Message is too large for peer to handle
99-
int CBLErrorWebSocketMissingExtension = 11010; // Peer doesn't provide a necessary extension
100-
int CBLErrorWebSocketCantFulfill = 11011; // Can't fulfill request due to "unexpected condition"
91+
int CBLErrorWebSocketBase = 11000; // ---- WebSocket status codes start here
92+
int CBLErrorWebSocketGoingAway = 11001; // Peer has to close, e.g. because host app is quitting
93+
int CBLErrorWebSocketProtocolError = 11002; // Protocol violation: invalid framing data
94+
int CBLErrorWebSocketDataError = 11003; // Message payload cannot be handled
95+
int CBLErrorWebSocketAbnormalClose = 11006; // TCP socket closed unexpectedly
96+
int CBLErrorWebSocketBadMessageFormat = 11007; // Unparseable WebSocket message
97+
int CBLErrorWebSocketPolicyError = 11008; // Message violated unspecified policy
98+
int CBLErrorWebSocketMessageTooBig = 11009; // Message is too large for peer to handle
99+
int CBLErrorWebSocketMissingExtension = 11010; // Peer doesn't provide a necessary extension
100+
int CBLErrorWebSocketCantFulfill = 11011; // Can't fulfill request due to "unexpected condition"
101+
int CBLErrorWebSocketCloseUserTransient = 14001; // Recoverable messaging error
102+
int CBLErrorWebSocketCloseUserPermanent = 14002; // Non-recoverable messaging error
101103
}
102104
}

0 commit comments

Comments
 (0)