mirror of https://github.com/fafhrd91/actix-web
Log errors
This commit is contained in:
parent
93484512b8
commit
17bac1d90f
|
@ -24,6 +24,7 @@ actix-http = "0.2.5"
|
||||||
actix-codec = "0.1.2"
|
actix-codec = "0.1.2"
|
||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
futures = "0.1.25"
|
futures = "0.1.25"
|
||||||
|
log = "0.4"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
//! Websocket integration
|
//! Websocket integration
|
||||||
|
use log::error;
|
||||||
|
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
|
@ -556,7 +558,7 @@ where
|
||||||
let data = data.unwrap_or_else(|| BytesMut::new());
|
let data = data.unwrap_or_else(|| BytesMut::new());
|
||||||
|
|
||||||
if self.collector.is_initialized() {
|
if self.collector.is_initialized() {
|
||||||
// Previous collection was already finalized
|
error!("Initialize a new fragmented sequence while another is active.");
|
||||||
return Err(ProtocolError::NoContinuation);
|
return Err(ProtocolError::NoContinuation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,7 +569,7 @@ where
|
||||||
let data = data.unwrap_or_else(|| BytesMut::new());
|
let data = data.unwrap_or_else(|| BytesMut::new());
|
||||||
|
|
||||||
if self.collector.is_initialized() {
|
if self.collector.is_initialized() {
|
||||||
// Previous collection was already finalized
|
error!("Initialize a new fragmented sequence while another is active.");
|
||||||
return Err(ProtocolError::NoContinuation);
|
return Err(ProtocolError::NoContinuation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,7 +584,10 @@ where
|
||||||
buf.extend_from_slice(data);
|
buf.extend_from_slice(data);
|
||||||
}
|
}
|
||||||
// Uninitialized continuation
|
// Uninitialized continuation
|
||||||
_ => return Err(ProtocolError::NoContinuation),
|
_ => {
|
||||||
|
error!("Trying to continue an uninitialized sequence of fragmented frames.");
|
||||||
|
return Err(ProtocolError::NoContinuation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
|
@ -602,7 +607,10 @@ where
|
||||||
Some(Message::Binary(buf.freeze()))
|
Some(Message::Binary(buf.freeze()))
|
||||||
}
|
}
|
||||||
// Uninitialized continuation
|
// Uninitialized continuation
|
||||||
Collector::Uninitialized => return Err(ProtocolError::NoContinuation),
|
Collector::Uninitialized => {
|
||||||
|
error!("Trying to end an uninitialized sequence of fragmented frames.");
|
||||||
|
return Err(ProtocolError::NoContinuation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue