mirror of
https://github.com/mamoe/mirai.git
synced 2025-04-25 13:03:35 +08:00
sendAndExpect: complete the result of the listener with last exception only if it has not yet completed. Maybe fix #2006.
This commit is contained in:
parent
008398bd84
commit
b16b3a58ac
@ -108,7 +108,11 @@ internal abstract class NetworkHandlerSupport(
|
||||
throwLast()
|
||||
} finally {
|
||||
packetListeners.remove(listener)
|
||||
listener.result.completeExceptionally(getLast() ?: IllegalStateException("No response"))
|
||||
if (listener.result.isActive) {
|
||||
listener.result.completeExceptionally(
|
||||
getLast() ?: IllegalStateException("Internal error: sendAndExpect failed without an exception.")
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user