threadshare/udpsrc: SocketAddr to InetSocketAddress direct conversion

This commit is contained in:
Abdul Rehman 2020-11-10 22:31:41 +05:00
parent 9c48de75d8
commit 178c7155a3

View file

@ -454,16 +454,10 @@ impl TaskImpl for UdpSrcTask {
.await .await
.retrieve_sender_address .retrieve_sender_address
{ {
let inet_addr = match saddr.ip() { NetAddressMeta::add(
IpAddr::V4(ip) => { buffer.get_mut().unwrap(),
gio::InetAddress::from_bytes(gio::InetAddressBytes::V4(&ip.octets())) &gio::InetSocketAddress::from(saddr),
} );
IpAddr::V6(ip) => {
gio::InetAddress::from_bytes(gio::InetAddressBytes::V6(&ip.octets()))
}
};
let inet_socket_addr = &gio::InetSocketAddress::new(&inet_addr, saddr.port());
NetAddressMeta::add(buffer.get_mut().unwrap(), inet_socket_addr);
} }
} }