From 3e9a8f9c746f36c2ca6a747e54aa91ab9e73b1d2 Mon Sep 17 00:00:00 2001 From: Robinson Date: Tue, 5 Sep 2023 12:58:38 +0200 Subject: [PATCH] Moved ping to the connection object --- src/dorkbox/network/Client.kt | 4 ++-- src/dorkbox/network/Configuration.kt | 12 ------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/dorkbox/network/Client.kt b/src/dorkbox/network/Client.kt index b5d4b769..a432d7de 100644 --- a/src/dorkbox/network/Client.kt +++ b/src/dorkbox/network/Client.kt @@ -950,11 +950,11 @@ open class Client( * * @return true if the ping was successfully sent to the client */ - fun ping(pingTimeoutSeconds: Int = config.pingTimeoutSeconds, function: Ping.() -> Unit): Boolean { + fun ping(function: Ping.() -> Unit): Boolean { val c = connection0 if (c != null) { - return super.ping(c, pingTimeoutSeconds, function) + return super.ping(c, function) } else { val exception = TransmitException("Cannot send a ping when there is no connection!") listenerManager.notifyError(exception) diff --git a/src/dorkbox/network/Configuration.kt b/src/dorkbox/network/Configuration.kt index e04c3cca..24fcb72d 100644 --- a/src/dorkbox/network/Configuration.kt +++ b/src/dorkbox/network/Configuration.kt @@ -437,15 +437,6 @@ abstract class Configuration protected constructor() { field = value } - /** - * Changes the default ping timeout, used to test the liveliness of a connection, specifically it's round-trip performance - */ - var pingTimeoutSeconds = 30 - set(value) { - require(!contextDefined) { errorMessage } - field = value - } - /** * Allows the user to change how endpoint settings and public key information are saved. * @@ -1034,7 +1025,6 @@ abstract class Configuration protected constructor() { config.connectionCloseTimeoutInSeconds = connectionCloseTimeoutInSeconds config.connectionExpirationTimoutNanos = connectionExpirationTimoutNanos config.isReliable = isReliable - config.pingTimeoutSeconds = pingTimeoutSeconds config.settingsStore = settingsStore config.serialization = serialization config.maxStreamSizeInMemoryMB = maxStreamSizeInMemoryMB @@ -1097,7 +1087,6 @@ abstract class Configuration protected constructor() { if (connectionExpirationTimoutNanos != other.connectionExpirationTimoutNanos) return false if (isReliable != other.isReliable) return false - if (pingTimeoutSeconds != other.pingTimeoutSeconds) return false if (settingsStore != other.settingsStore) return false if (serialization != other.serialization) return false if (maxStreamSizeInMemoryMB != other.maxStreamSizeInMemoryMB) return false @@ -1124,7 +1113,6 @@ abstract class Configuration protected constructor() { result = 31 * result + enableRemoteSignatureValidation.hashCode() result = 31 * result + ipcId result = 31 * result + udpId - result = 31 * result + pingTimeoutSeconds result = 31 * result + connectionCloseTimeoutInSeconds result = 31 * result + connectionExpirationTimoutNanos.hashCode() result = 31 * result + isReliable.hashCode()