lib/protocol/http2/framer.rb in protocol-http2-0.16.0 vs lib/protocol/http2/framer.rb in protocol-http2-0.17.0

- old
+ new

@@ -39,10 +39,14 @@ def initialize(stream, frames = FRAMES) @stream = stream @frames = frames end + def flush + @stream.flush + end + def close @stream.close end def closed? @@ -67,30 +71,30 @@ # @raise if the underlying IO fails for some reason. def read_frame(maximum_frame_size = MAXIMUM_ALLOWED_FRAME_SIZE) # Read the header: length, type, flags, stream_id = read_header - # Async.logger.debug(self) {"read_frame: length=#{length} type=#{type} flags=#{flags} stream_id=#{stream_id} -> klass=#{@frames[type].inspect}"} + # Console.debug(self) {"read_frame: length=#{length} type=#{type} flags=#{flags} stream_id=#{stream_id} -> klass=#{@frames[type].inspect}"} # Allocate the frame: klass = @frames[type] || Frame frame = klass.new(stream_id, flags, type, length) # Read the payload: frame.read(@stream, maximum_frame_size) - # Async.logger.debug(self, name: "read") {frame.inspect} + # Console.debug(self, name: "read") {frame.inspect} return frame end + # Write a frame to the underlying IO. + # After writing one or more frames, you should call flush to ensure the frames are sent to the remote peer. + # @parameter frame [Frame] the frame to write. def write_frame(frame) - # Async.logger.debug(self, name: "write") {frame.inspect} + # Console.debug(self, name: "write") {frame.inspect} frame.write(@stream) - - # Don't call @stream.flush here because it can cause significant contention if there is a semaphore around this method. - # @stream.flush return frame end def read_header