Fix warnings

This commit is contained in:
Carl Lerche
2017-08-24 15:52:01 -07:00
parent 638791ac6c
commit b0e6867877
26 changed files with 91 additions and 238 deletions

View File

@@ -2,8 +2,6 @@ use ConnectionError;
use proto::*;
use error::Reason::*;
use std::cmp;
#[derive(Copy, Clone, Debug)]
pub struct FlowControl {
/// Window size as indicated by the peer. This can go negative.
@@ -49,21 +47,8 @@ impl FlowControl {
self.available -= capacity;
}
pub fn assign_capacity(&mut self, capacity: WindowSize)
-> Result<(), ConnectionError>
{
let (val, overflow) = self.available.overflowing_add(capacity);
if overflow {
return Err(FlowControlError.into());
}
if val > MAX_WINDOW_SIZE {
return Err(FlowControlError.into());
}
self.available = val;
Ok(())
pub fn assign_capacity(&mut self, capacity: WindowSize) {
self.available + capacity;
}
/// Returns the number of bytes available but not assigned to the window.