hubcio commented on code in PR #2768:
URL: https://github.com/apache/iggy/pull/2768#discussion_r2824303060


##########
core/sdk/src/quic/quic_client.rs:
##########
@@ -165,14 +165,9 @@ impl QuicClient {
 
     /// Create a new QUIC client for the provided configuration.
     pub fn create(config: Arc<QuicClientConfig>) -> Result<Self, IggyError> {
-        let server_address = config
-            .server_address
-            .parse::<SocketAddr>()
-            .map_err(|error| {
-                error!("Invalid server address: {error}");
-                IggyError::InvalidServerAddress
-            })?;
-        let client_address = if server_address.is_ipv6()
+        let resolved_addr = config.server_address.parse::<SocketAddr>().ok();
+
+        let client_address = if resolved_addr.is_some_and(|a| a.is_ipv6())
             && config.client_address == 
QuicClientConfig::default().client_address
         {
             "[::1]:0"

Review Comment:
   the IPv6 client endpoint detection is broken for hostnames.
   
   parse::<SocketAddr>().ok() returns None for any hostname, so
   is_some_and(|a| a.is_ipv6()) is always false and the endpoint
   always binds to 0.0.0.0:0 (IPv4). if the hostname later
   resolves to an IPv6 address in connect(), the IPv4-bound UDP
   socket can't reach it.
   
   and create() is sync 🥲 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to