Skip to content

Commit

Permalink
Also call stream.close() if cancelled
Browse files Browse the repository at this point in the history
  • Loading branch information
lauzadis committed Aug 1, 2024
1 parent c906b75 commit e43b4e0
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ internal class SdkStreamResponseHandler(
}

// short circuit, stop buffering data and discard remaining incoming bytes
if (isCancelled) return bodyBytesIn.len
if (isCancelled) {
crtStream?.close()
stream.close()
return bodyBytesIn.len
}

val buffer = SdkBuffer().apply {
val bytes = bodyBytesIn.readAll()
Expand Down

0 comments on commit e43b4e0

Please sign in to comment.