Fixed seconds -> MS for RMI ping

This commit is contained in:
Robinson 2022-04-04 19:39:05 +02:00
parent 113de5d12e
commit ac4afd3d50
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C

View File

@ -23,6 +23,7 @@ import dorkbox.network.connection.Connection
import dorkbox.network.rmi.ResponseManager
import kotlinx.coroutines.CoroutineScope
import mu.KLogger
import java.util.concurrent.*
/**
* How to handle ping messages
@ -79,7 +80,7 @@ internal class PingManager<CONNECTION : Connection> {
}
// ALWAYS cancel the ping after 30 seconds
responseManager.cancelRequest(actionDispatch, pingTimeoutSeconds.toLong(), id, logger) {
responseManager.cancelRequest(actionDispatch, TimeUnit.SECONDS.toMillis(pingTimeoutSeconds.toLong()), id, logger) {
// kill the callback, since we are now "cancelled". If there is a race here (and the response comes at the exact same time)
// we don't care since either it will be null or it won't (if it's not null, it will run the callback)
result = null