Lost Illusion
02/14/2022, 9:51 PMincoming.filterIsInstance<WampRawTransportPacket.Handshake>().first()
however, I also want to have a timeout around it as to not hang forever if the remote server does something weird. So I used the withTimeoutOrNull function, but I encounter some odd behavior.
withTimeoutOrNull(connectionConfig.handshakeTimeout) {
incoming.filterIsInstance<WampRawTransportPacket.Handshake>().first()
} ?: throw WampTimeout(
remoteAddress,
"Timed out waiting ${connectionConfig.handshakeTimeout}ms for a handshake back!"
)
It will always time out after 5 seconds (that is what handshakeTimeout is currently configured at). If I take it out of the timeout, it works flawlessly and returns nearly instantly. Is there some side effect of the coroutine that timeout provides that I don't know about?Lost Illusion
02/14/2022, 11:14 PM