Skip to content

Commit 50632dc

Browse files
committed
small resume/suspend fix
1 parent 0b45666 commit 50632dc

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Sources/TCP/Streams/TCPSocketSink.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ public final class TCPSocketSink: Async.InputStream {
5656
fatalError("SocketSink upstream is illegally overproducing input buffers.")
5757
}
5858
inputBuffer = input
59-
writeData(ready: ready)
59+
guard currentReadyPromise == nil else {
60+
fatalError("SocketSink currentReadyPromise illegally not nil during input.")
61+
}
62+
currentReadyPromise = ready
63+
resumeIfSuspended()
6064
case .close:
6165
close()
6266
case .error(let e):

Sources/TCP/Streams/TCPSocketSource.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public final class TCPSocketSource: Async.OutputStream {
6060
/// See OutputStream.output
6161
public func output<S>(to inputStream: S) where S: Async.InputStream, S.Input == Output {
6262
downstream = AnyInputStream(inputStream)
63-
readData()
63+
resumeIfSuspended()
6464
}
6565

6666
/// Cancels reading

0 commit comments

Comments
 (0)