From b3804361d287875ac4e9c046043c962d936a2f94 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Mon, 17 Jul 2023 03:48:45 +0100 Subject: [PATCH] add log message for MPTCP bind failure --- actix-server/src/builder.rs | 2 ++ actix-server/src/socket.rs | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/actix-server/src/builder.rs b/actix-server/src/builder.rs index 8ccd691e..9869fe52 100644 --- a/actix-server/src/builder.rs +++ b/actix-server/src/builder.rs @@ -13,6 +13,8 @@ use crate::{ }; /// Multipath TCP (MPTCP) preference. +/// +/// Also see [`ServerBuilder::mptcp()`]. #[derive(Debug, Clone)] pub enum MpTcp { /// MPTCP will not be used when binding sockets. diff --git a/actix-server/src/socket.rs b/actix-server/src/socket.rs index 7bbef962..63fbd525 100644 --- a/actix-server/src/socket.rs +++ b/actix-server/src/socket.rs @@ -240,13 +240,14 @@ pub(crate) fn create_mio_tcp_listener( let socket = match Socket::new(Domain::for_address(addr), Type::STREAM, Some(protocol)) { Ok(sock) => sock, - Err(err) => { - if matches!(mptcp, MpTcp::TcpFallback) { - Socket::new(Domain::for_address(addr), Type::STREAM, Some(Protocol::TCP))? - } else { - return Err(err); - } + + Err(err) if matches!(mptcp, MpTcp::TcpFallback) => { + tracing::warn!("binding socket as MPTCP failed: {err}"); + tracing::warn!("falling back to TCP"); + Socket::new(Domain::for_address(addr), Type::STREAM, Some(Protocol::TCP))? } + + Err(err) => return Err(err), }; socket.set_reuse_address(true)?;