BugFix Force Relay Reconnection when writing a new events.
This commit is contained in:
@@ -284,16 +284,36 @@ class Relay(
|
|||||||
checkNotInMainThread()
|
checkNotInMainThread()
|
||||||
|
|
||||||
if (signedEvent is RelayAuthEvent) {
|
if (signedEvent is RelayAuthEvent) {
|
||||||
|
// specific protocol for this event.
|
||||||
val event = """["AUTH",${signedEvent.toJson()}]"""
|
val event = """["AUTH",${signedEvent.toJson()}]"""
|
||||||
socket?.send(event)
|
socket?.send(event)
|
||||||
eventUploadCounterInBytes += event.bytesUsedInMemory()
|
eventUploadCounterInBytes += event.bytesUsedInMemory()
|
||||||
}
|
} else {
|
||||||
|
if (write) {
|
||||||
|
if (isConnected()) {
|
||||||
|
if (isReady) {
|
||||||
|
val event = """["EVENT",${signedEvent.toJson()}]"""
|
||||||
|
socket?.send(event)
|
||||||
|
eventUploadCounterInBytes += event.bytesUsedInMemory()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// waits 60 seconds to reconnect after disconnected.
|
||||||
|
if (TimeUtils.now() > closingTimeInSeconds + RECONNECTING_IN_SECONDS) {
|
||||||
|
// sends all filters after connection is successful.
|
||||||
|
connectAndRun {
|
||||||
|
checkNotInMainThread()
|
||||||
|
|
||||||
if (write) {
|
val event = """["EVENT",${signedEvent.toJson()}]"""
|
||||||
if (signedEvent !is RelayAuthEvent) {
|
socket?.send(event)
|
||||||
val event = """["EVENT",${signedEvent.toJson()}]"""
|
eventUploadCounterInBytes += event.bytesUsedInMemory()
|
||||||
socket?.send(event)
|
|
||||||
eventUploadCounterInBytes += event.bytesUsedInMemory()
|
// Sends everything.
|
||||||
|
Client.allSubscriptions().forEach {
|
||||||
|
sendFilter(requestId = it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user