Guarantee that connect occurs AFTER the current close events are finished running before redispatching on the connect dispatcher
This commit is contained in:
parent
88bac6ef84
commit
76f42c900c
|
@ -459,16 +459,21 @@ open class Client<CONNECTION : Connection>(config: ClientConfiguration = ClientC
|
||||||
if (eventDispatch.isDispatch() && !eventDispatch.CONNECT.isDispatch()) {
|
if (eventDispatch.isDispatch() && !eventDispatch.CONNECT.isDispatch()) {
|
||||||
// only re-dispatch if we are on the event dispatch AND it's not the CONNECT one
|
// only re-dispatch if we are on the event dispatch AND it's not the CONNECT one
|
||||||
// if we are on an "outside" thread, then we don't care.
|
// if we are on an "outside" thread, then we don't care.
|
||||||
eventDispatch.CONNECT.launch {
|
|
||||||
connect(
|
// we have to guarantee that CLOSE finishes running first! If we are already on close, then this will just run after close is finished.
|
||||||
remoteAddress = remoteAddress,
|
eventDispatch.CLOSE.launch {
|
||||||
remoteAddressString = remoteAddressString,
|
eventDispatch.CONNECT.launch {
|
||||||
remoteAddressPrettyString = remoteAddressPrettyString,
|
connect(
|
||||||
port1 = port1,
|
remoteAddress = remoteAddress,
|
||||||
port2 = port2,
|
remoteAddressString = remoteAddressString,
|
||||||
connectionTimeoutSec = connectionTimeoutSec,
|
remoteAddressPrettyString = remoteAddressPrettyString,
|
||||||
reliable = reliable)
|
port1 = port1,
|
||||||
|
port2 = port2,
|
||||||
|
connectionTimeoutSec = connectionTimeoutSec,
|
||||||
|
reliable = reliable)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue