Skip to content
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

Handle service unavailable case when sending message, thanks to EDG #1659

Merged
merged 4 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ internal abstract class SendMessageHandler<C : Contact> {
}
}
}
if (resp is MessageSvcPbSendMsg.Response.ServiceUnavailable){
throw IllegalStateException("Send message to $contact failed, server service is unavailable.")
Karlatemp marked this conversation as resolved.
Show resolved Hide resolved
}
if (resp is MessageSvcPbSendMsg.Response.Failed) {
val contact = contact
when (resp.resultType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ internal object MessageSvcPbSendMsg : OutgoingPacketFactory<MessageSvcPbSendMsg.
object MessageTooLarge : Response() {
override fun toString(): String = "MessageSvcPbSendMsg.Response.MessageTooLarge"
}
object ServiceUnavailable : Response() {
override fun toString(): String = "MessageSvcPbSendMsg.Response.ServiceUnavailable"
}

/**
* 121: 被限制? 个别号才不能发
Expand Down Expand Up @@ -463,6 +466,7 @@ internal object MessageSvcPbSendMsg : OutgoingPacketFactory<MessageSvcPbSendMsg.
return when (response.result) {
0 -> Response.SUCCESS
10 -> Response.MessageTooLarge
32 -> Response.ServiceUnavailable
else -> Response.Failed(
response.result,
response.errtype,
Expand Down