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.
This commit is contained in:
Carl Lerche
2018-04-28 12:25:22 -07:00
committed by GitHub
parent 6ea00162b9
commit 9aaa8f06d1
2 changed files with 7 additions and 6 deletions
+2 -1
View File
@@ -22,7 +22,7 @@ race:crossbeam_deque
# TODO: It would be nice to not have to filter this out. # TODO: It would be nice to not have to filter this out.
race:try_steal_task 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 # 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 # 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 # 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 # original pop operation will fail due to the ABA guard, but tsan still picks
# up the access on the next pointer. # up the access on the next pointer.
race:Backup::next_sleeper race:Backup::next_sleeper
race:WorkerEntry::set_next_sleeper
+5 -5
View File
@@ -1,6 +1,6 @@
use {codec, AsyncRead, AsyncWrite}; use {codec, AsyncRead, AsyncWrite};
use bytes::{Buf, BufMut, BytesMut, IntoBuf, BigEndian, LittleEndian}; use bytes::{Buf, BufMut, BytesMut, IntoBuf};
use bytes::buf::Chain; use bytes::buf::Chain;
use futures::{Async, AsyncSink, Stream, Sink, StartSend, Poll}; use futures::{Async, AsyncSink, Stream, Sink, StartSend, Poll};
@@ -291,9 +291,9 @@ impl Decoder {
// match endianess // match endianess
let n = if self.builder.length_field_is_big_endian { let n = if self.builder.length_field_is_big_endian {
src.get_uint::<BigEndian>(field_len) src.get_uint_be(field_len)
} else { } else {
src.get_uint::<LittleEndian>(field_len) src.get_uint_le(field_len)
}; };
if n > self.builder.max_frame_len as u64 { if n > self.builder.max_frame_len as u64 {
@@ -479,9 +479,9 @@ impl<T: AsyncWrite, B: IntoBuf> FramedWrite<T, B> {
}; };
if self.builder.length_field_is_big_endian { if self.builder.length_field_is_big_endian {
head.put_uint::<BigEndian>(n as u64, self.builder.length_field_len); head.put_uint_be(n as u64, self.builder.length_field_len);
} else { } else {
head.put_uint::<LittleEndian>(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()); debug_assert!(self.frame.is_none());