mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-06 08:00:10 +08:00
Add check for arguments of NetworkHandlerSupport.sendAndExpect
This commit is contained in:
parent
9ceb7c3fc2
commit
84fb928764
@ -88,6 +88,7 @@ internal abstract class NetworkHandlerSupport(
|
|||||||
}
|
}
|
||||||
|
|
||||||
final override suspend fun sendAndExpect(packet: OutgoingPacket, timeout: Long, attempts: Int): Packet? {
|
final override suspend fun sendAndExpect(packet: OutgoingPacket, timeout: Long, attempts: Int): Packet? {
|
||||||
|
require(attempts >= 1) { "attempts must be at least 1." }
|
||||||
val listener = PacketListener(packet.commandName, packet.sequenceId)
|
val listener = PacketListener(packet.commandName, packet.sequenceId)
|
||||||
withExceptionCollector {
|
withExceptionCollector {
|
||||||
repeat(attempts) {
|
repeat(attempts) {
|
||||||
|
Loading…
Reference in New Issue
Block a user