mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-02 12:50:16 +08:00
Remove state CONNECTION_LOST
This commit is contained in:
parent
84fa460b32
commit
035085cf45
@ -72,15 +72,6 @@ internal interface NetworkHandler {
|
|||||||
*/
|
*/
|
||||||
OK,
|
OK,
|
||||||
|
|
||||||
/**
|
|
||||||
* No Internet Connection available or for any other reasons
|
|
||||||
* but it is possible to establish a connection again(switching state to [CONNECTING]).
|
|
||||||
*
|
|
||||||
* At this state [resumeConnection] turns the handle to [CONNECTING].
|
|
||||||
* [sendAndExpect] throws [IllegalStateException]
|
|
||||||
*/
|
|
||||||
CONNECTION_LOST,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cannot resume anymore. Both [resumeConnection] and [sendAndExpect] throw a [CancellationException].
|
* Cannot resume anymore. Both [resumeConnection] and [sendAndExpect] throw a [CancellationException].
|
||||||
*
|
*
|
||||||
|
@ -47,7 +47,6 @@ internal abstract class AbstractKeepAliveNetworkHandlerSelector<H : NetworkHandl
|
|||||||
this.current.compareAndSet(current, null) // invalidate the instance and try again.
|
this.current.compareAndSet(current, null) // invalidate the instance and try again.
|
||||||
awaitResumeInstance() // will create new instance.
|
awaitResumeInstance() // will create new instance.
|
||||||
}
|
}
|
||||||
NetworkHandler.State.CONNECTION_LOST,
|
|
||||||
NetworkHandler.State.CONNECTING,
|
NetworkHandler.State.CONNECTING,
|
||||||
NetworkHandler.State.INITIALIZED -> {
|
NetworkHandler.State.INITIALIZED -> {
|
||||||
current.resumeConnection()
|
current.resumeConnection()
|
||||||
|
@ -317,24 +317,6 @@ internal class NettyNetworkHandler(
|
|||||||
override fun toString(): String = "StateOK"
|
override fun toString(): String = "StateOK"
|
||||||
}
|
}
|
||||||
|
|
||||||
private inner class StateConnectionLost(
|
|
||||||
private val cause: Throwable?
|
|
||||||
) : NettyState(State.CONNECTION_LOST) {
|
|
||||||
override fun getCause(): Throwable? = cause
|
|
||||||
|
|
||||||
override suspend fun sendPacketImpl(packet: OutgoingPacket) {
|
|
||||||
throw IllegalStateException(
|
|
||||||
"Internal error: connection is lost so cannot send packet. Call resumeConnection first.",
|
|
||||||
cause
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun resumeConnection0() {
|
|
||||||
setState { StateConnecting(ExceptionCollector(cause)) }
|
|
||||||
.resumeConnection()
|
|
||||||
} // noop
|
|
||||||
}
|
|
||||||
|
|
||||||
private inner class StateClosed(
|
private inner class StateClosed(
|
||||||
val exception: Throwable?
|
val exception: Throwable?
|
||||||
) : NettyState(State.CLOSED) {
|
) : NettyState(State.CLOSED) {
|
||||||
|
Loading…
Reference in New Issue
Block a user