lib/protocol/http2/framer.rb in protocol-http2-0.7.2 vs lib/protocol/http2/framer.rb in protocol-http2-0.7.4

- old
+ new

@@ -50,12 +50,10 @@ # Default connection "fast-fail" preamble string as defined by the spec. CONNECTION_PREFACE_MAGIC = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n".freeze class Framer - # DEBUG = !!ENV['FRAMER_DEBUG'] - def initialize(stream, frames = FRAMES) @stream = stream @frames = frames end @@ -84,25 +82,27 @@ # @return [Frame] the frame that has been read from the underlying IO. # @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 - # puts "read_frame: length=#{length} type=#{type} flags=#{flags} stream_id=#{stream_id} -> klass=#{@frames[type].inspect}" + # Async.logger.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) - # DEBUG and puts "read_frame: #{frame.inspect}" + # Async.logger.debug(self, name: "read") {frame.inspect} return frame end def write_frame(frame) - # DEBUG and puts "write_frame: #{frame.inspect}" + # Async.logger.debug(self, name: "write") {frame.inspect} + frame.write(@stream) @stream.flush return frame