connectionTimeoutMS == 0, now (correctly) means wait forever
This commit is contained in:
parent
6d63401fba
commit
dfec897f83
|
@ -228,6 +228,9 @@ open class Client<CONNECTION : Connection>(config: Configuration = Configuration
|
||||||
ipcPublicationId: Int = AeronConfig.IPC_HANDSHAKE_STREAM_ID_SUB,
|
ipcPublicationId: Int = AeronConfig.IPC_HANDSHAKE_STREAM_ID_SUB,
|
||||||
ipcSubscriptionId: Int = AeronConfig.IPC_HANDSHAKE_STREAM_ID_PUB,
|
ipcSubscriptionId: Int = AeronConfig.IPC_HANDSHAKE_STREAM_ID_PUB,
|
||||||
connectionTimeoutMS: Long = 30_000L, reliable: Boolean = true) {
|
connectionTimeoutMS: Long = 30_000L, reliable: Boolean = true) {
|
||||||
|
|
||||||
|
require(connectionTimeoutMS >= 0) { "connectionTimeoutMS '$connectionTimeoutMS' is invalid. It must be >0" }
|
||||||
|
|
||||||
// this will exist ONLY if we are reconnecting via a "disconnect" callback
|
// this will exist ONLY if we are reconnecting via a "disconnect" callback
|
||||||
lockStepForReconnect.value?.doWait()
|
lockStepForReconnect.value?.doWait()
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ internal class ClientHandshake<CONNECTION: Connection>(private val crypto: Crypt
|
||||||
val pollIdleStrategy = endPoint.config.pollIdleStrategy
|
val pollIdleStrategy = endPoint.config.pollIdleStrategy
|
||||||
|
|
||||||
val startTime = System.currentTimeMillis()
|
val startTime = System.currentTimeMillis()
|
||||||
while (System.currentTimeMillis() - startTime < connectionTimeoutMS) {
|
while (connectionTimeoutMS == 0L || System.currentTimeMillis() - startTime < connectionTimeoutMS) {
|
||||||
// NOTE: regarding fragment limit size. Repeated calls to '.poll' will reassemble a fragment.
|
// NOTE: regarding fragment limit size. Repeated calls to '.poll' will reassemble a fragment.
|
||||||
// `.poll(handler, 4)` == `.poll(handler, 2)` + `.poll(handler, 2)`
|
// `.poll(handler, 4)` == `.poll(handler, 2)` + `.poll(handler, 2)`
|
||||||
pollCount = subscription.poll(handler, 1)
|
pollCount = subscription.poll(handler, 1)
|
||||||
|
@ -183,7 +183,7 @@ internal class ClientHandshake<CONNECTION: Connection>(private val crypto: Crypt
|
||||||
val pollIdleStrategy = endPoint.config.pollIdleStrategy
|
val pollIdleStrategy = endPoint.config.pollIdleStrategy
|
||||||
|
|
||||||
var startTime = System.currentTimeMillis()
|
var startTime = System.currentTimeMillis()
|
||||||
while (System.currentTimeMillis() - startTime < connectionTimeoutMS) {
|
while (connectionTimeoutMS == 0L || System.currentTimeMillis() - startTime < connectionTimeoutMS) {
|
||||||
// NOTE: regarding fragment limit size. Repeated calls to '.poll' will reassemble a fragment.
|
// NOTE: regarding fragment limit size. Repeated calls to '.poll' will reassemble a fragment.
|
||||||
// `.poll(handler, 4)` == `.poll(handler, 2)` + `.poll(handler, 2)`
|
// `.poll(handler, 4)` == `.poll(handler, 2)` + `.poll(handler, 2)`
|
||||||
pollCount = subscription.poll(handler, 1)
|
pollCount = subscription.poll(handler, 1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user