change from deprecated Buf::put_*<E> to put_*_be (#267)

This commit is contained in:
Sean McArthur
2018-04-27 14:35:28 -07:00
committed by Carl Lerche
parent fadec67fdf
commit e8fcd34476
8 changed files with 17 additions and 18 deletions

View File

@@ -32,7 +32,7 @@ unstable = []
[dependencies]
futures = "0.1"
tokio-io = "0.1.4"
bytes = "0.4"
bytes = "0.4.7"
http = "0.1.3"
byteorder = "1.0"
log = "0.4.1"

View File

@@ -1,6 +1,6 @@
use frame::{self, Error, Head, Kind, Reason, StreamId};
use bytes::{BigEndian, BufMut};
use bytes::{BufMut};
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub struct GoAway {
@@ -42,8 +42,8 @@ impl GoAway {
trace!("encoding GO_AWAY; code={:?}", self.error_code);
let head = Head::new(Kind::GoAway, 0, StreamId::zero());
head.encode(8, dst);
dst.put_u32::<BigEndian>(self.last_stream_id.into());
dst.put_u32::<BigEndian>(self.error_code.into());
dst.put_u32_be(self.last_stream_id.into());
dst.put_u32_be(self.error_code.into());
}
}

View File

@@ -1,6 +1,6 @@
use super::StreamId;
use bytes::{BigEndian, BufMut};
use bytes::{BufMut};
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct Head {
@@ -66,10 +66,10 @@ impl Head {
pub fn encode<T: BufMut>(&self, payload_len: usize, dst: &mut T) {
debug_assert!(self.encode_len() <= dst.remaining_mut());
dst.put_uint::<BigEndian>(payload_len as u64, 3);
dst.put_uint_be(payload_len as u64, 3);
dst.put_u8(self.kind as u8);
dst.put_u8(self.flag);
dst.put_u32::<BigEndian>(self.stream_id.into());
dst.put_u32_be(self.stream_id.into());
}
}

View File

@@ -371,7 +371,7 @@ impl PushPromise {
self.header_block.into_encoding()
.encode(&head, encoder, dst, |dst| {
dst.put_u32::<BigEndian>(promised_id.into());
dst.put_u32_be(promised_id.into());
})
}

View File

@@ -1,6 +1,6 @@
use frame::{self, Error, Head, Kind, Reason, StreamId};
use bytes::{BigEndian, BufMut};
use bytes::{BufMut};
#[derive(Debug, Eq, PartialEq)]
pub struct Reset {
@@ -45,7 +45,7 @@ impl Reset {
);
let head = Head::new(Kind::Reset, 0, self.stream_id);
head.encode(4, dst);
dst.put_u32::<BigEndian>(self.error_code.into());
dst.put_u32_be(self.error_code.into());
}
}

View File

@@ -1,4 +1,4 @@
use bytes::{BigEndian, BufMut, BytesMut};
use bytes::{BufMut, BytesMut};
use frame::{Error, Frame, FrameSize, Head, Kind, StreamId};
#[derive(Debug, Clone, Default, Eq, PartialEq)]
@@ -280,8 +280,8 @@ impl Setting {
MaxHeaderListSize(v) => (6, v),
};
dst.put_u16::<BigEndian>(kind);
dst.put_u32::<BigEndian>(val);
dst.put_u16_be(kind);
dst.put_u32_be(val);
}
}

View File

@@ -1,6 +1,6 @@
use frame::{self, Error, Head, Kind, StreamId};
use bytes::{BigEndian, BufMut};
use bytes::{BufMut};
const SIZE_INCREMENT_MASK: u32 = 1 << 31;
@@ -51,7 +51,7 @@ impl WindowUpdate {
trace!("encoding WINDOW_UPDATE; id={:?}", self.stream_id);
let head = Head::new(Kind::WindowUpdate, 0, self.stream_id);
head.encode(4, dst);
dst.put_u32::<BigEndian>(self.size_increment);
dst.put_u32_be(self.size_increment);
}
}

View File

@@ -1,3 +1,4 @@
#![deny(warnings)]
#[macro_use]
extern crate log;
@@ -881,8 +882,6 @@ fn rst_while_closing() {
#[test]
fn rst_with_buffered_data() {
use futures::future::lazy;
// Data is buffered in `FramedWrite` and the stream is reset locally before
// the data is fully flushed. Given that resetting a stream requires
// clearing all associated state for that stream, this test ensures that the
@@ -932,7 +931,7 @@ fn rst_with_buffered_data() {
stream.send_data(body.into(), true).unwrap();
conn.drive({
resp.then(|res| {
resp.then(|_res| {
Ok::<_, ()>(())
})
})