Skip to content

Commit 2c3d6d9

Browse files
committed
Tidy up implementation of pipe.
1 parent 3d5f990 commit 2c3d6d9

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/async/http/body/pipe.rb

+3-5
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,18 @@
2222

2323
require_relative 'writable'
2424

25-
require 'forwardable'
26-
2725
module Async
2826
module HTTP
2927
module Body
3028
class Pipe
31-
extend Forwardable
32-
29+
# If the input stream is closed first, it's likely the output stream will also be closed.
3330
def initialize(input, output = Writable.new, task: Task.current)
3431
@input = input
3532
@output = output
3633

3734
head, tail = IO::Socket.pair(Socket::AF_UNIX, Socket::SOCK_STREAM)
3835

39-
@head = Async::IO::Stream.new(head)
36+
@head = IO::Stream.new(head)
4037
@tail = tail
4138

4239
@reader = nil
@@ -90,6 +87,7 @@ def writer(task)
9087
end
9188
ensure
9289
@writer = nil
90+
9391
@output.close($!)
9492

9593
@head.close if @reader.nil?

0 commit comments

Comments
 (0)