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

fix(core): potential memory leak in WebSocketClient #3624

Merged
merged 1 commit into from
May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ extension WebSocketClient: URLSessionWebSocketDelegate {
extension WebSocketClient {
/// Monitor network status. Disconnect or reconnect when the network drops or comes back online.
private func startNetworkMonitor() {
networkMonitor.publisher.sink(receiveValue: { stateChange in
networkMonitor.publisher.sink(receiveValue: { [weak self] stateChange in
Task { [weak self] in
await self?.onNetworkStateChange(stateChange)
}
Expand Down Expand Up @@ -304,7 +304,7 @@ extension WebSocketClient {
return closeCode
}
.compactMap { $0 }
.sink(receiveCompletion: { _ in }) { closeCode in
.sink(receiveCompletion: { _ in }) { [weak self] closeCode in
Task { [weak self] in await self?.retryOnCloseCode(closeCode) }
}
.store(in: &cancelables)
Expand All @@ -319,7 +319,7 @@ extension WebSocketClient {
}
return false
}
.sink(receiveCompletion: { _ in }) { _ in
.sink(receiveCompletion: { _ in }) { [weak self] _ in
Task { [weak self] in
await self?.retryWithJitter.reset()
}
Expand Down
Loading