From aeb70a6579342a1be0bf217ebccee86d77256cb7 Mon Sep 17 00:00:00 2001 From: hailin Date: Tue, 27 Jan 2026 04:22:46 -0800 Subject: [PATCH] =?UTF-8?q?fix(android):=20registerParty=20=E5=89=8D?= =?UTF-8?q?=E7=AD=89=E5=BE=85=20channel=20READY?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题:connect() 是异步的,registerParty() 在 channel 还是 CONNECTING 时就被调用,导致 RST_STREAM 错误 修复:在 registerParty() 开头等待 channel READY 后再发送请求 Co-Authored-By: Claude Opus 4.5 --- .../java/com/durian/tssparty/data/remote/GrpcClient.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/mpc-system/services/service-party-android/app/src/main/java/com/durian/tssparty/data/remote/GrpcClient.kt b/backend/mpc-system/services/service-party-android/app/src/main/java/com/durian/tssparty/data/remote/GrpcClient.kt index 096c1bc0..7d372fdb 100644 --- a/backend/mpc-system/services/service-party-android/app/src/main/java/com/durian/tssparty/data/remote/GrpcClient.kt +++ b/backend/mpc-system/services/service-party-android/app/src/main/java/com/durian/tssparty/data/remote/GrpcClient.kt @@ -593,6 +593,15 @@ class GrpcClient @Inject constructor() { partyRole: String = "temporary", version: String = "1.0.0" ): Result = withContext(Dispatchers.IO) { + // 必须等待 channel READY 后才能注册 + Log.d(TAG, "registerParty: Waiting for channel READY...") + val isReady = waitForChannelReady(CONNECTION_TIMEOUT_SECONDS * 1000) + if (!isReady) { + Log.e(TAG, "registerParty: Channel not ready after timeout") + return@withContext Result.failure(Exception("Channel not ready")) + } + Log.d(TAG, "registerParty: Channel is READY, proceeding with registration") + // Save for re-registration registeredPartyId = partyId registeredPartyRole = partyRole