Skip to content

Commit

Permalink
Merge pull request #153 from shiguredo/feature/disconnect-listener-on…
Browse files Browse the repository at this point in the history
…close-last

SoraMediaChannel.Listener.onCloseの呼び出しタイミングを修正する
  • Loading branch information
zztkm authored Feb 25, 2025
2 parents 21de4dd + 4cffa11 commit 268ea91
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
- @zztkm
- [ADD] サイマルキャストの映像のエンコーディングパラメーター `scaleResolutionDownTo` を追加する
- @zztkm
- [FIX] `SoraMediaChannel.internalDisconnect` での `SoraMediaChannel.Listener.onClose` の呼び出しタイミングを切断処理がすべて完了したあとに修正する
- 切断処理が終了する前に `onClose` を呼び出していたため、切断処理が完了してから呼び出すように修正
- `contactSignalingEndpoint``connectedSignalingEndpoint` は onClose で参照される可能性があるため、onClose 実行よりあとに null になるように onClose に合わせて処理順を変更
- @zztkm

## 2025.1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -957,13 +957,6 @@ class SoraMediaChannel @JvmOverloads constructor(
}
compositeDisposable.dispose()

listener?.onClose(this)
listener = null

// アプリケーションで定義された切断処理を実行した後に contactSignalingEndpoint と connectedSignalingEndpoint を null にする
contactSignalingEndpoint = null
connectedSignalingEndpoint = null

// 既に type: disconnect を送信しているので、 disconnectReason は null で良い
signaling?.disconnect(null)
signaling = null
Expand All @@ -974,6 +967,13 @@ class SoraMediaChannel @JvmOverloads constructor(
// 既に type: disconnect を送信しているので、 disconnectReason は null で良い
peer?.disconnect(null)
peer = null

listener?.onClose(this)
listener = null

// onClose によってアプリケーションで定義された切断処理を実行した後に contactSignalingEndpoint と connectedSignalingEndpoint を null にする
contactSignalingEndpoint = null
connectedSignalingEndpoint = null
}

private fun sendDisconnectOverWebSocket(disconnectReason: SoraDisconnectReason) {
Expand Down

0 comments on commit 268ea91

Please sign in to comment.