]> git.puffer.fish Git - mirror/frr.git/commit
lib: optimize sockunion_connect() 1357/head
authorRenato Westphal <renato@opensourcerouting.org>
Mon, 23 Oct 2017 21:24:07 +0000 (19:24 -0200)
committerRenato Westphal <renato@opensourcerouting.org>
Tue, 24 Oct 2017 21:30:31 +0000 (19:30 -0200)
commitb11b57723b963fb5d0ab11748b7957f0b7fa5d37
tree55ddd237d50698bc0a53a42b41def519b337c935
parentcbb65f5ef53d9029811e248608125ffa293753eb
lib: optimize sockunion_connect()

This function is only called with non-blocking sockets [1], so there's
no need to worry about setting O_NONBLOCK and unsetting it later if the
given fd was a blocking socket. This saves us 4 syscalls per connect,
which is not much but is something.

Also, remove an outdated comment about the return values of this
function. It returns a 'connect_result' enum now, whose values are
self-explanatory (connect_error, connect_success and connect_in_progress).

This also fixes a coverity scan warning where we weren't checking the
return value of the fcntl() syscall.

[1] bgp_connect() and pim_msdp_sock_connect().

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
lib/sockunion.c