sleeprite / rudis

Rudis is a high-performance in memory database

Home Page:https://sleeprite.github.io/rudis/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

为什么要重新new SocketAddr这个对象?

MangerLe opened this issue · comments

这里为什么要重新new这个对象而不是直接使用前面这个?
我感觉是有点多余的,不知道是不是有别的用意?

let socket_addr = match string_addr.to_socket_addrs() {
        Ok(mut addr_iter) => addr_iter.next().unwrap(),
        Err(e) => {
            eprintln!("Failed to resolve bind address: {}", e);
            return;
        }
    };
 //TODO 为什么再次去生成SocketAddr ?
let address = SocketAddr::new(socket_addr.ip(), socket_addr.port());

已优化