]> git.tuebingen.mpg.de Git - paraslash.git/commit - net.c
net: Improve error diagnostics of makesock_addrinfo().
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 22 Mar 2018 01:09:43 +0000 (02:09 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Tue, 17 Apr 2018 07:29:57 +0000 (09:29 +0200)
commit1319d78c9a00faf49f6104ab8c2813558367e442
treec43ed96a6e8040b2358b599798a50b19fad5d0cf
parent2b004fc5dc0c652c6eb4daf84e5875f2c852ca72
net: Improve error diagnostics of makesock_addrinfo().

Since the function iterates over all addresses in the passed
addressinfo structure, errors can be non-fatal and may even be
expected. Therefore the function does not log any errors from
socket(2), setsockopt(2), connect(2) or bind(2), but only returns
a generic -E_MAKESOCK error code if none of the addressinfo members
worked. Unfortunately, this means it's impossible to tell from the
log message which of these system calls has failed.

This patch changes the function to also log the errors from the above
system calls, but only with loglevel notice. This way the non-fatal
errors are not shown by default (since the default loglevel is
"warning"), but one can easily activate them by specifying a lower
loglevel.
net.c