aboutsummaryrefslogtreecommitdiff
path: root/controller
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-03-28 21:23:36 +0100
committerTom Smeding <tom.smeding@gmail.com>2020-03-28 21:30:41 +0100
commitd4ba9f948f5acc5f6c22db0b5f2a1666262acc59 (patch)
tree7db005c5fdd10f3ac3dd788045c0073ef569e159 /controller
parent58dbe88ca932b4c998d8d012e88b3b5bd575edc5 (diff)
controller: Set keepalive on sockets
Diffstat (limited to 'controller')
-rw-r--r--controller/src/lib.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/controller/src/lib.rs b/controller/src/lib.rs
index b53502f..60b3639 100644
--- a/controller/src/lib.rs
+++ b/controller/src/lib.rs
@@ -120,6 +120,15 @@ enum ThreadCollect {
async fn thread_handshake_handler(mut listener: TcpListener, sink: mpsc::Sender<ThreadCollect>) {
loop {
let (mut sock, _) = listener.accept().await.expect("Accept failed on TCP server socket");
+
+ // Error setting keepalive is not fatal
+ match sock.set_keepalive(Some(std::time::Duration::from_secs(60))) {
+ Ok(()) => {}
+ Err(e) => {
+ eprintln!("WARNING: Error setting keepalive on worker socket: {}", e);
+ }
+ }
+
let mut sink = sink.clone();
task::spawn(async move {
let payload = encode_message(MessageBody::Version(1));