unix_msg: always create a send queue for a peer
authorRalph Boehme <slow@samba.org>
Fri, 19 Aug 2016 07:22:54 +0000 (09:22 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 12 Sep 2016 22:19:27 +0000 (00:19 +0200)
commit95f3d9bb497c9e18bbdead25f6abf485014ba769
tree9f776a5854fda3792b0b5da663a1661217237e54
parent16d076662139be1e1ebd5f26509bad3188dd9bc8
unix_msg: always create a send queue for a peer

Previously, we only created a send queue for a peer if the initial send
to the non-blocking non-connected socket reported EWOULDBOCK (because
the channel was full).

With this change, we now always create a send queue and use a connected,
non-blocking datagram socket from the beginning.

Initially, the socket of the send queue is set to non-blocking mode and
we attempt a direct send via sendmsg(). If that returns EWOULDBOCK, we
set the send queue to blocking mode and let the threadpool handle the
IO.

When a send queue becomes empty, we set the send queue socket back to
non-blocking.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/unix_msg/unix_msg.c