Merge branch 'type-ascription' into implicit-return-type

This commit is contained in:
Tim Kuehn
2016-02-11 22:22:14 -08:00

View File

@@ -26,8 +26,7 @@ struct ConnectionHandler<'a, S>
impl<'a, S> ConnectionHandler<'a, S>
where S: Serve
{
fn handle_conn<'b>(&'b mut self, scope: &Scope<'b>) -> Result<()>
{
fn handle_conn<'b>(&'b mut self, scope: &Scope<'b>) -> Result<()> {
let ConnectionHandler {
ref mut read_stream,
ref mut write_stream,
@@ -151,7 +150,7 @@ impl<'a, S: 'a> Server<'a, S>
return;
}
Err(TryRecvError::Disconnected) => {
info!("serve: sender disconnected.");
info!("serve: shutdown sender disconnected.");
return;
}
_ => (),
@@ -165,10 +164,19 @@ impl<'a, S: 'a> Server<'a, S>
};
if let Err(err) = conn.set_read_timeout(self.read_timeout) {
info!("serve: could not set read timeout: {:?}", err);
return;
continue;
}
let read_conn = match conn.try_clone() {
Err(err) => {
error!("serve: could not clone tcp stream; possibly out of file descriptors? \
Err: {:?}",
err);
continue;
}
Ok(conn) => conn,
};
let mut handler = ConnectionHandler {
read_stream: BufReader::new(conn.try_clone().expect(pos!())),
read_stream: BufReader::new(read_conn),
write_stream: BufWriter::new(conn),
server: self.server,
shutdown: self.shutdown,