Browse Source

chore: clarify port range error message when binding fails (#9040)

* improve: clarify port range error message when binding fails

  When binding two ports with an offset fails, the error message now clearly
  indicates that ports are "already in use" and shows the specific port range
  that was attempted. This helps users quickly diagnose port conflicts when
  setting up validators.

  Fixes #9032

Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>

* chore: include offset value in port binding error messages

Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>

---------

Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
Avhi 1 week ago
parent
commit
9c2cb25131
1 changed files with 3 additions and 3 deletions
  1. 3 3
      net-utils/src/sockets.rs

+ 3 - 3
net-utils/src/sockets.rs

@@ -306,9 +306,9 @@ pub fn bind_two_in_range_with_offset_and_config(
             }
         }
     }
-    Err(io::Error::other(
-        "couldn't find two ports with the correct offset in range".to_string(),
-    ))
+    Err(io::Error::other(format!(
+        "couldn't find two unused ports with offset {offset} in range {range:?}"
+    )))
 }
 
 pub fn bind_more_with_config(