为什么要重新new SocketAddr这个对象?
MangerLe opened this issue · comments
MangerLe commented
这里为什么要重新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());
就眠儀式 commented
已优化