p5-Protocol-HTTP2 icon indicating copy to clipboard operation
p5-Protocol-HTTP2 copied to clipboard

Add on_goaway callback

Open pelov opened this issue 5 years ago • 2 comments

Add a on_goaway callback to Procotol::HTTP2::Client->new. It should be called when the server sends a GOAWAY frame. It should receive last_stream_id, error_code and the additional data (which is usually a text).

Right now, the only way to see these frames is to turn on debugging. However, this frame is important to a client so that it can stop opening new streams and prepare to shutdown the connection. Also the error code and the additional data can be very useful for diagnosing problems.

I don't mind trying to make this change myself - just want to know if I have a green light for that.

pelov avatar Jun 17 '20 20:06 pelov

Feel free to send PR with this feature

vlet avatar Jun 18 '20 11:06 vlet

I figured that a simpler solution would be to store the information from the GOAWAY frame in the $con->{goaway} as a hash with keys last_stream_id, error and data. The above commit does just that.

It works for me but I don't know if it fits well with the rest of the code.

pelov avatar Jun 18 '20 22:06 pelov