Fix mattery network dispatcher preventing server from exiting sometimes
This commit is contained in:
parent
7ce30ffd81
commit
49fc5b5eaf
@ -166,14 +166,16 @@ abstract class MatteryNetworkChannel(val version: String, val name: String) {
|
|||||||
internal fun onServerStarting() {
|
internal fun onServerStarting() {
|
||||||
interrupt = false
|
interrupt = false
|
||||||
check(thread == null) { "Already having network dispatcher thread, ServerStartingEvent was fired twice!" }
|
check(thread == null) { "Already having network dispatcher thread, ServerStartingEvent was fired twice!" }
|
||||||
thread = Thread(this::run, "Overdrive That Matters Network Dispatcher").also { it.start() }
|
thread = Thread(this::run, "Overdrive That Matters Network Dispatcher").also { it.isDaemon = true; it.start() }
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun onServerStopping() {
|
internal fun onServerStopping() {
|
||||||
|
LockSupport.unpark(thread)
|
||||||
interrupt = true
|
interrupt = true
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun onServerStopped() {
|
internal fun onServerStopped() {
|
||||||
|
LockSupport.unpark(thread)
|
||||||
interrupt = true
|
interrupt = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user