p5-Protocol-HTTP2
p5-Protocol-HTTP2 copied to clipboard
Add on_goaway callback
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.
Feel free to send PR with this feature
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.