Author: tridge
Date: 2005-06-11 02:26:53 +0000 (Sat, 11 Jun 2005)
New Revision: 7476

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7476

Log:
ensure dgram sockets are created non-blocking. As they usually skip
the connect() stage, we were missing this

Modified:
   branches/SAMBA_4_0/source/lib/socket/socket.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/socket/socket.c
===================================================================
--- branches/SAMBA_4_0/source/lib/socket/socket.c       2005-06-11 01:34:42 UTC 
(rev 7475)
+++ branches/SAMBA_4_0/source/lib/socket/socket.c       2005-06-11 02:26:53 UTC 
(rev 7476)
@@ -69,6 +69,12 @@
                (*new_sock)->flags |= SOCKET_FLAG_TESTNONBLOCK;
        }
 
+       /* we don't do a connect() on dgram sockets, so need to set
+          non-blocking at socket create time */
+       if (!(flags & SOCKET_FLAG_BLOCK) && type == SOCKET_TYPE_DGRAM) {
+               set_blocking(socket_get_fd(*new_sock), False);
+       }
+
        talloc_set_destructor(*new_sock, socket_destructor);
 
        return NT_STATUS_OK;

Reply via email to