[core] Fix network initialize order; Ensure bot components when network handler allocated; fix #2740

This commit is contained in:
Karlatemp 2023-07-25 19:23:06 +08:00
parent eab15f9125
commit 61e8501c66
No known key found for this signature in database
GPG Key ID: BA173CA2B9956C59

View File

@ -135,8 +135,10 @@ internal abstract class AbstractBot(
@Volatile
var networkInitialized = false
val network: NetworkHandler by lazy {
networkInitialized = true
createNetworkHandler()
createNetworkHandler().also {
it.context // ensure components available
networkInitialized = true
}
} // the selector handles renewal of [NetworkHandler]
final override suspend fun login() {