r3279: Removed MSG_DONTWAIT flags as many platform don't have it.
authorAndrew Tridgell <tridge@samba.org>
Wed, 27 Oct 2004 03:45:35 +0000 (03:45 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:04:49 +0000 (13:04 -0500)
If a socket is non-blocking then adding MSG_DONTWAIT is pointless (it
does nothing), so all we lose is the ability to set non-blocking on a
packet-by-packet basis, which is not a very useful thing to have
anyway

if the socket is blocking then the code already adds MSG_WAITALL, so
MSG_DONTWAIT is also not needed in that case.

source/lib/socket/socket_ipv4.c
source/lib/socket/socket_unix.c

index 20dfd3c92f42e9640b4fcacb5631d1e489f9dc91..3fda0fe9fbe15dfb0aff49c6623051b648bde5bf 100644 (file)
@@ -183,10 +183,6 @@ static NTSTATUS ipv4_tcp_recv(struct socket_context *sock, TALLOC_CTX *mem_ctx,
                flgs |= MSG_PEEK;
        }
 
-       if (!(flags & SOCKET_FLAG_BLOCK)) {
-               flgs |= MSG_DONTWAIT;
-       }
-
        if (flags & SOCKET_FLAG_BLOCK) {
                flgs |= MSG_WAITALL;
        }
@@ -227,16 +223,11 @@ static NTSTATUS ipv4_tcp_recv(struct socket_context *sock, TALLOC_CTX *mem_ctx,
 }
 
 static NTSTATUS ipv4_tcp_send(struct socket_context *sock, TALLOC_CTX *mem_ctx,
-                                       const DATA_BLOB *blob, size_t *sendlen, uint32_t flags)
+                             const DATA_BLOB *blob, size_t *sendlen, uint32_t flags)
 {
        ssize_t len;
        int flgs = 0;
 
-       /* TODO: we need to map all flags here */
-       if (!(flags & SOCKET_FLAG_BLOCK)) {
-               flgs |= MSG_DONTWAIT;
-       }
-
        len = send(sock->fd, blob->data, blob->length, flgs);
        if (len == -1) {
                return map_nt_error_from_unix(errno);
index 90802eae660e26d7c6650d5b53f92c991f7b489f..eda1597df7d85c7e992ba60af928d1aaaf12cfe4 100644 (file)
@@ -172,10 +172,6 @@ static NTSTATUS unixdom_recv(struct socket_context *sock, TALLOC_CTX *mem_ctx,
                flgs |= MSG_PEEK;
        }
 
-       if (!(flags & SOCKET_FLAG_BLOCK)) {
-               flgs |= MSG_DONTWAIT;
-       }
-
        if (flags & SOCKET_FLAG_BLOCK) {
                flgs |= MSG_WAITALL;
        }
@@ -207,11 +203,6 @@ static NTSTATUS unixdom_send(struct socket_context *sock, TALLOC_CTX *mem_ctx,
 
        *sendlen = 0;
 
-       /* TODO: we need to map all flags here */
-       if (!(flags & SOCKET_FLAG_BLOCK)) {
-               flgs |= MSG_DONTWAIT;
-       }
-
        len = send(sock->fd, blob->data, blob->length, flgs);
        if (len == -1) {
                return unixdom_error(errno);