-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support auto reconnect for ReverseWebsocketAdapter #621
Conversation
...p/src/main/kotlin/net/mamoe/mirai/api/http/adapter/reverse/ReverseWebsocketAdapterSetting.kt
Outdated
Show resolved
Hide resolved
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/adapter/reverse/client/WsClient.kt
Outdated
Show resolved
Hide resolved
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/adapter/reverse/client/WsClient.kt
Outdated
Show resolved
Hide resolved
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/adapter/reverse/client/WsClient.kt
Outdated
Show resolved
Hide resolved
while (client.isActive) { | ||
try { | ||
client.ws(buildWsRequest(destination, setting)) { | ||
webSocketSession = this | ||
|
||
handleReverseWs(this@WsClient) | ||
handleReverseWs(this@WsClient) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是不是没处理掉线期间新消息进入这个 old session 的问题 (suspend fun send(content: String)
)
在等待重连的时候 send
被执行不会有问题吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我让 ws session 变成 nullable 了,不过可能还是会有 data race...
感谢 review,明天我会尝试修复这些东西()
|
没问题啊, mah是jvm only的 |
主要是担心其他 engine 的行为不同(毕竟 ktor) |
Problem: it seemed that I directly imported exceptions from
java.net
.Disclaimer: I don't know kotlin.