[pbs-devel] [PATCH proxmox v4 3/4] proxmox-async: add connect_to_udp helper

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Feb 1 13:39:00 CET 2022


On 01.02.22 13:13, Dominik Csapak wrote:
> On 2/1/22 13:02, Thomas Lamprecht wrote:
>>> +    addr: A,
>>> +) -> io::Result<UdpSocket> {
>>> +    let socket = match tokio::net::lookup_host(&addr).await?.next() {> +        Some(SocketAddr::V4(_)) => UdpSocket::bind("0.0.0.0:0").await?,
>>> +        Some(SocketAddr::V6(_)) => UdpSocket::bind("[::]:0").await?,
>>> +        None => proxmox_sys::io_bail!("could not resolve address family {}", addr),
>>
>> would it have some merit to use {:?} to loose the Display trait bound?
>> Probably not to relevant though.
>>
> 
> then we'd need the Debug trait though, so no real gain?
> 

hmm, thought that was implied, meh.. Normally one would want to pass it via the error
(type) upwards and let the caller handle it, but those error types can be stupid too...





More information about the pbs-devel mailing list