Hi,
I don't think that patch can work. Because if you remove the call to
getaddrinfo() there is no
longer anything that converts the string into an ip address/structure
and you would end up
further down trying to dereference ai (which is NULL).
But If what we pass to getaddrinfo() is an ipv4/ipv6 address it
should never block.
It is only if we pass a hostname there and need to rely on the local
resolver to convert into an address it can block.
Since there is no standard async resolver here, we need to rely on
getaddrinfo() at least to parse the address into an ai structure.
The right thing here is probably to document in the header something like
...
iscsi_connect_async() calls getaddrinfo() to resolve the string into
an ip address. This call is only
non-blocking if you pass a string containing an ip address to it.
If you pass a hostname that needs to be looked up, then this function
will block while the local resolver
will try to do the host lookup. This may block for an extended period
in some configurations/environments.
If you require that iscsi_connect_async() to be non-blocking, you can
not call it with a hostname as argument but will have to convert it
into an ipv4/v6 string before, using what async name resolution
libraries are available on your platform.
...
or something.
Can you create a documentation patch for the header to document this ?
regards
ronnie sahlberg