cleanly close ctl_gateway server stream after message is sent
@@ -56,7 +56,8 @@ use std::{error,
sync::{Arc,
Mutex},
time::Duration};
-use tokio::{net::TcpListener,
+use tokio::{io::AsyncWrite,
+ net::TcpListener,
task,
time};
use tokio_util::codec::Decoder;
@@ -444,6 +445,10 @@ impl Future for SrvHandler {
if let Some(timer) = self.timer.take() {
timer.observe_duration();
}
+ if let Err(err) = futures::ready!(Pin::new(self.io.get_mut()).poll_shutdown(cx))
+ {
+ return Poll::Ready(Err(HandlerError::from(err)));
+ }
trace!("OnMessage complete");
break;
}
