From 9aaa8f06d1f03346fd682ab9d826b521d2efad5e Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Sat, 28 Apr 2018 12:25:22 -0700 Subject: [PATCH] Stop using deprecated bytes APIs (#324) This also adds a filter for another treiber stack expected data race. The race is expected as part of the algorithm. --- ci/tsan | 3 ++- tokio-io/src/length_delimited.rs | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ci/tsan b/ci/tsan index e81ae6914..22a358abf 100644 --- a/ci/tsan +++ b/ci/tsan @@ -22,7 +22,7 @@ race:crossbeam_deque # TODO: It would be nice to not have to filter this out. race:try_steal_task -# This filters out an expected data race in the treiber stack implementation. +# This filters out expected data race in the treiber stack implementations. # Treiber stacks are inherently racy. The pop operation will attempt to access # the "next" pointer on the node it is attempting to pop. However, at this # point it has not gained ownership of the node and another thread might beat @@ -30,3 +30,4 @@ race:try_steal_task # original pop operation will fail due to the ABA guard, but tsan still picks # up the access on the next pointer. race:Backup::next_sleeper +race:WorkerEntry::set_next_sleeper diff --git a/tokio-io/src/length_delimited.rs b/tokio-io/src/length_delimited.rs index 7e6635d1d..b9f847622 100644 --- a/tokio-io/src/length_delimited.rs +++ b/tokio-io/src/length_delimited.rs @@ -1,6 +1,6 @@ use {codec, AsyncRead, AsyncWrite}; -use bytes::{Buf, BufMut, BytesMut, IntoBuf, BigEndian, LittleEndian}; +use bytes::{Buf, BufMut, BytesMut, IntoBuf}; use bytes::buf::Chain; use futures::{Async, AsyncSink, Stream, Sink, StartSend, Poll}; @@ -291,9 +291,9 @@ impl Decoder { // match endianess let n = if self.builder.length_field_is_big_endian { - src.get_uint::(field_len) + src.get_uint_be(field_len) } else { - src.get_uint::(field_len) + src.get_uint_le(field_len) }; if n > self.builder.max_frame_len as u64 { @@ -479,9 +479,9 @@ impl FramedWrite { }; if self.builder.length_field_is_big_endian { - head.put_uint::(n as u64, self.builder.length_field_len); + head.put_uint_be(n as u64, self.builder.length_field_len); } else { - head.put_uint::(n as u64, self.builder.length_field_len); + head.put_uint_le(n as u64, self.builder.length_field_len); } debug_assert!(self.frame.is_none());