Commit c353e8e8 authored by Him188moe's avatar Him188moe

Updated robot & network structure

sendPacket is not async now
parent 406b6c61
......@@ -363,19 +363,20 @@ internal class RobotNetworkHandler(private val robot: Robot) : Closeable {
}
/**
* Not async
*/
@ExperimentalUnsignedTypes
fun sendPacket(packet: ClientPacket) {
MiraiThreadPool.getInstance().submit {
try {
packet.encode()
packet.writeHex(Protocol.tail)
val data = packet.toByteArray()
socket.send(DatagramPacket(data, data.size))
MiraiLogger info "Packet sent: $packet"
} catch (e: Throwable) {
e.printStackTrace()
}
try {
packet.encode()
packet.writeHex(Protocol.tail)
val data = packet.toByteArray()
socket.send(DatagramPacket(data, data.size))
MiraiLogger info "Packet sent: $packet"
} catch (e: Throwable) {
e.printStackTrace()
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment