Skip to content

Commit

Permalink
Add back line based decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheikah45 committed Oct 13, 2023
1 parent 07e4a1b commit a1b5947
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.faforever.commons.lobby

import com.fasterxml.jackson.databind.ObjectMapper
import io.netty.handler.codec.LineBasedFrameDecoder
import io.netty.handler.codec.string.LineEncoder
import io.netty.handler.codec.string.LineSeparator
import io.netty.resolver.DefaultAddressResolverGroup
import org.slf4j.Logger
import org.slf4j.LoggerFactory
Expand All @@ -14,9 +17,12 @@ import reactor.core.publisher.Sinks.EmitResult
import reactor.core.scheduler.Schedulers
import reactor.netty.Connection
import reactor.netty.http.client.HttpClient
import reactor.netty.http.client.WebsocketClientSpec
import reactor.netty.tcp.TcpClient
import reactor.util.retry.Retry
import reactor.util.retry.Retry.RetrySignal
import java.net.InetSocketAddress
import java.net.URI
import java.time.Duration
import java.util.function.Function

Expand Down Expand Up @@ -72,7 +78,7 @@ class FafLobbyClient(
is LoginSuccessResponse -> Mono.just(it.me)
is LoginFailedResponse -> Mono.error(LoginException(it.text))
}
}.timeout(Duration.ofSeconds(30))
}.timeout(Duration.ofSeconds(10))
.doOnError(LoginException::class.java) { kicked = true }
.doFirst {
prepareAuthenticateOnNextSession()
Expand Down Expand Up @@ -111,6 +117,8 @@ class FafLobbyClient(
.doOnConnected {
val address = it.channel().remoteAddress() as InetSocketAddress
LOG.info("Connected to {} on port {}", address.hostName, address.port)
it.addHandlerFirst(LineEncoder(LineSeparator.UNIX)) // TODO: This is not working. Raise a bug ticket! Workaround below
.addHandlerLast(LineBasedFrameDecoder(config.bufferSize))
connection = it
connectionAcquiredSink.emitNext(true, retrySerialFailure)
}.doOnDisconnected {
Expand Down

0 comments on commit a1b5947

Please sign in to comment.