Fix build with no alloc or collections.

v0.7.x
whitequark 2017-01-22 20:29:45 +00:00
parent 20e7ba7cf3
commit 62f094d276
2 changed files with 3 additions and 0 deletions

View File

@ -61,6 +61,7 @@ impl<'a, 'b: 'a, 'c: 'a + 'b> Set<'a, 'b, 'c> {
ManagedSlice::Borrowed(_) => {
panic!("adding a socket to a full SocketSet")
}
#[cfg(any(feature = "use_std", feature = "use_collections"))]
ManagedSlice::Owned(ref mut sockets) => {
sockets.push(None);
let index = sockets.len() - 1;

View File

@ -477,6 +477,7 @@ impl<'a> TcpSocket<'a> {
pub fn send(&mut self, size: usize) -> Result<&mut [u8], ()> {
if !self.may_send() { return Err(()) }
#[cfg(any(test, feature = "verbose"))]
let old_length = self.tx_buffer.len();
let buffer = self.tx_buffer.enqueue(size);
if buffer.len() > 0 {
@ -512,6 +513,7 @@ impl<'a> TcpSocket<'a> {
// but until the connection is fully open we refuse to dequeue any data.
if !self.may_recv() { return Err(()) }
#[cfg(any(test, feature = "verbose"))]
let old_length = self.rx_buffer.len();
let buffer = self.rx_buffer.dequeue(size);
self.remote_seq_no += buffer.len();