mirror of
https://github.com/tursom/TursomServer.git
synced 2025-01-01 07:50:47 +08:00
fix bug
This commit is contained in:
parent
4fbe5236ee
commit
e8b6d29c4e
@ -16,7 +16,7 @@ object NioClient {
|
||||
@JvmStatic
|
||||
private val nioThread = WorkerLoopNioThread(
|
||||
"nioClient",
|
||||
daemon = false,
|
||||
daemon = true,
|
||||
workLoop = WorkerLoopHandler(AsyncProtocol)
|
||||
)
|
||||
|
||||
@ -29,6 +29,7 @@ object NioClient {
|
||||
return suspendCoroutine { cont ->
|
||||
val channel = SocketChannel.open()!!
|
||||
channel.configureBlocking(false)
|
||||
channel.connect(InetSocketAddress(host, port))
|
||||
nioThread.register(channel, SelectionKey.OP_CONNECT) { key ->
|
||||
key.attach(AsyncProtocol.ConnectContext(cont, if (timeout > 0) AsyncNioChannel.timer.exec(timeout) {
|
||||
channel.close()
|
||||
@ -37,7 +38,6 @@ object NioClient {
|
||||
null
|
||||
}))
|
||||
}
|
||||
channel.connect(InetSocketAddress(host, port))
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user