Fix push promise frame parsing (#309)

This commit is contained in:
Michael Beaumont
2018-09-17 23:55:37 +02:00
committed by Sean McArthur
parent 2b960b897d
commit 586106adf2
3 changed files with 30 additions and 10 deletions

View File

@@ -57,14 +57,14 @@ macro_rules! poll_err {
}
#[macro_export]
macro_rules! poll_data {
($transport:expr) => {{
macro_rules! poll_frame {
($type: ident, $transport:expr) => {{
use h2::frame::Frame;
use futures::Async;
match $transport.poll() {
Ok(Async::Ready(Some(Frame::Data(frame)))) => frame,
frame => panic!("expected data frame; actual={:?}", frame),
Ok(Async::Ready(Some(Frame::$type(frame)))) => frame,
frame => panic!("unexpected frame; actual={:?}", frame),
}
}}
}