mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-18 00:00:09 +02:00
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:
@@ -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
|
||||
|
||||
@@ -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::<BigEndian>(field_len)
|
||||
src.get_uint_be(field_len)
|
||||
} else {
|
||||
src.get_uint::<LittleEndian>(field_len)
|
||||
src.get_uint_le(field_len)
|
||||
};
|
||||
|
||||
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 {
|
||||
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 {
|
||||
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());
|
||||
|
||||
Reference in New Issue
Block a user