Skip to content

Commit

Permalink
HTTP/2: mark some stream#send methods as protected
Browse files Browse the repository at this point in the history
Some frame types shouldn't be publicly available, but only
accessible by the HTTP2 module, otherwise thay may hinder or just
break the connection. For example: WINDOW_UPDATE, RST_STREAM, or
changing the stream state.
  • Loading branch information
ysbaddaden committed Oct 25, 2017
1 parent 0916569 commit 52b712f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/stream.cr
Expand Up @@ -110,7 +110,7 @@ module HTTP2
@window_size -= frame.payload.size
end

def send_window_update_frame(increment)
protected def send_window_update_frame(increment)
unless MINIMUM_WINDOW_SIZE <= increment <= MAXIMUM_WINDOW_SIZE
raise Exception.new("invalid WINDOW_UPDATE increment: #{increment}")
end
Expand Down Expand Up @@ -218,18 +218,18 @@ module HTTP2
@fiber = nil
end

def send_rst_stream(error_code : Error::Code)
protected def send_rst_stream(error_code : Error::Code)
io = IO::Memory.new
io.write_bytes(error_code.value.to_u32, IO::ByteFormat::BigEndian)
io.rewind
connection.send Frame.new(Frame::Type::RST_STREAM, self, 0, io.to_slice)
end

def receiving(frame : Frame)
protected def receiving(frame : Frame)
transition(frame, receiving: true)
end

def sending(frame : Frame)
protected def sending(frame : Frame)
transition(frame, receiving: false)
end

Expand Down

0 comments on commit 52b712f

Please sign in to comment.