connect event dispatch check only redispatches when it's ON the EDT, but NOT in the correct one

This commit is contained in:
Robinson 2023-08-09 21:31:00 -06:00
parent e9f7172b62
commit 3852677feb
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
1 changed files with 3 additions and 1 deletions

View File

@ -471,7 +471,9 @@ open class Client<CONNECTION : Connection>(
// on the client, we must GUARANTEE that the disconnect/close completes before NEW connect begins.
// we will know this if we are running inside an INTERNAL dispatch that is NOT the connect dispatcher!
if (EventDispatcher.getCurrentEvent() != EventDispatcher.CONNECT) {
val currentEvent = EventDispatcher.getCurrentEvent()
if (currentEvent != null && currentEvent != EventDispatcher.CONNECT) {
// only re-dispatch if we are on the event dispatch AND it's not the CONNECT one
EventDispatcher.CONNECT.launch {
connect(
remoteAddress = remoteAddress,