mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-28 16:50:09 +08:00
Add bot.job
as parent of NetworkHandlerSupport
This commit is contained in:
parent
5f7f350eb5
commit
c8def70594
@ -32,9 +32,11 @@ import kotlin.reflect.KClass
|
|||||||
* Implements basic logics of [NetworkHandler]
|
* Implements basic logics of [NetworkHandler]
|
||||||
*/
|
*/
|
||||||
internal abstract class NetworkHandlerSupport(
|
internal abstract class NetworkHandlerSupport(
|
||||||
override val context: NetworkHandlerContext,
|
final override val context: NetworkHandlerContext,
|
||||||
coroutineContext: CoroutineContext = EmptyCoroutineContext,
|
additionalCoroutineContext: CoroutineContext = EmptyCoroutineContext,
|
||||||
) : NetworkHandler, CoroutineScope by coroutineContext.childScope(SupervisorJob()) {
|
) : NetworkHandler, CoroutineScope {
|
||||||
|
final override val coroutineContext: CoroutineContext =
|
||||||
|
additionalCoroutineContext.childScopeContext(SupervisorJob(context.bot.coroutineContext.job))
|
||||||
|
|
||||||
protected abstract fun initialState(): BaseStateImpl
|
protected abstract fun initialState(): BaseStateImpl
|
||||||
protected abstract suspend fun sendPacketImpl(packet: OutgoingPacket)
|
protected abstract suspend fun sendPacketImpl(packet: OutgoingPacket)
|
||||||
|
Loading…
Reference in New Issue
Block a user