Skip to content

Commit 2efd416

Browse files
committed
RPC 関連処理にコメントを追加する
1 parent e5bcc86 commit 2efd416

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Sora/RPC.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ public final class RPCChannel {
146146

147147
var pending: Pending?
148148
if !isNotificationRequest, let identifier {
149+
// タイムアウト時に実行されるタスク
149150
let workItem = DispatchWorkItem { [weak self] in
150151
self?.finishPending(id: identifier, result: .failure(SoraError.rpcTimeout))
151152
}
@@ -172,9 +173,11 @@ public final class RPCChannel {
172173
}
173174

174175
if !isNotificationRequest, let pending {
176+
// リクエストのタイムアウトをスケジュール
175177
DispatchQueue.global().asyncAfter(
176178
deadline: .now() + timeout, execute: pending.timeoutWorkItem)
177179
} else {
180+
// notification の場合は即座に完了
178181
completion?(.success(nil))
179182
}
180183

@@ -203,7 +206,10 @@ public final class RPCChannel {
203206
}
204207

205208
if let method = json["method"] as? String {
206-
Logger.error(type: .dataChannel, message: "rpc request is not supported: \(method)")
209+
// SDK から request / notification を送り、response を Sora から受け取る
210+
// 一方通行の通信が前提になっており、 request / notification が届いても
211+
// 処理できないためエラーにする
212+
Logger.error(type: .dataChannel, message: "rpc request/notification is not supported: \(method)")
207213
return
208214
}
209215

0 commit comments

Comments
 (0)