Skip to content

Commit

Permalink
Don't have separate connection disposable
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheikah45 committed Oct 13, 2023
1 parent 06e91a2 commit dc76c71
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ class FafLobbyClient(

private lateinit var config: Config

private var connection: Connection? = null;
private var connectionDisposable: Disposable? = null
private var connection: Connection? = null
private var pingDisposable: Disposable? = null
private var connecting: Boolean = false

Expand Down Expand Up @@ -152,8 +151,7 @@ class FafLobbyClient(

private fun openConnection() {
LOG.debug("Opening connection")
connectionDisposable?.dispose()
connectionDisposable = webSocketClient
webSocketClient
.uri(config.url)
.handle { inbound, outbound ->
val inboundMono = inbound.receive()
Expand Down Expand Up @@ -228,6 +226,7 @@ class FafLobbyClient(
of the connections finishes */
Mono.firstWithSignal(inboundMono, outboundMono)
}
.doOnCancel { LOG.info("Connection cancelled") }
.doOnSubscribe {
LOG.debug("Beginning connection process")
connectionStatusSink.emitNext(ConnectionStatus.CONNECTING, retrySerialFailure)
Expand Down Expand Up @@ -286,7 +285,7 @@ class FafLobbyClient(
}

private fun send(message: ClientMessage) {
LOG.trace("Sending {}", message)
LOG.trace("Sending message of type {}", message.javaClass)
outboundSink.emitNext(message, retrySerialFailure)
}

Expand Down

0 comments on commit dc76c71

Please sign in to comment.