mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-31 11:30:16 +08:00
[core] Fix network initialize order; Ensure bot components when network handler allocated; fix #2740
This commit is contained in:
parent
eab15f9125
commit
61e8501c66
@ -135,8 +135,10 @@ internal abstract class AbstractBot(
|
|||||||
@Volatile
|
@Volatile
|
||||||
var networkInitialized = false
|
var networkInitialized = false
|
||||||
val network: NetworkHandler by lazy {
|
val network: NetworkHandler by lazy {
|
||||||
|
createNetworkHandler().also {
|
||||||
|
it.context // ensure components available
|
||||||
networkInitialized = true
|
networkInitialized = true
|
||||||
createNetworkHandler()
|
}
|
||||||
} // the selector handles renewal of [NetworkHandler]
|
} // the selector handles renewal of [NetworkHandler]
|
||||||
|
|
||||||
final override suspend fun login() {
|
final override suspend fun login() {
|
||||||
|
Loading…
Reference in New Issue
Block a user