[vlc-devel] [PATCH 5/5] network: use vlc_send()

Steve Lhomme robux4 at ycbcr.xyz
Sat Mar 28 15:07:29 CET 2020


No explanation why MSG_NOSIGNAL is gone ?

The patchset might be split in just moving calls into the core and doing 
some more changes.

On 2020-03-28 8:20, RĂ©mi Denis-Courmont wrote:
> ---
>   include/vlc_network.h  | 4 ----
>   src/misc/interrupt.c   | 4 ++--
>   src/network/io.c       | 2 +-
>   src/network/stream.c   | 4 ++--
>   src/posix/filesystem.c | 3 +++
>   5 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/include/vlc_network.h b/include/vlc_network.h
> index c403e9a638..9e1ccd24cc 100644
> --- a/include/vlc_network.h
> +++ b/include/vlc_network.h
> @@ -56,10 +56,6 @@
>   #   define net_Close(fd) ((void)vlc_close(fd))
>   #endif
>   
> -#ifndef MSG_NOSIGNAL
> -# define MSG_NOSIGNAL 0
> -#endif
> -
>   /**
>    * Creates a socket file descriptor.
>    *
> diff --git a/src/misc/interrupt.c b/src/misc/interrupt.c
> index 6512462ff2..2bd29b86b3 100644
> --- a/src/misc/interrupt.c
> +++ b/src/misc/interrupt.c
> @@ -505,8 +505,8 @@ ssize_t vlc_sendmsg_i11e(int fd, const struct msghdr *msg, int flags)
>   
>       if (vlc_poll_i11e(&ufd, 1, -1) < 0)
>           return -1;
> -    /* NOTE: MSG_EOR, MSG_OOB and MSG_NOSIGNAL should all work fine here. */
> -    return sendmsg(fd, msg, flags);
> +    /* NOTE: MSG_EOR and MSG_OOB should all work fine here. */
> +    return vlc_sendmsg(fd, msg, flags);
>   }
>   
>   ssize_t vlc_sendto_i11e(int fd, const void *buf, size_t len, int flags,
> diff --git a/src/network/io.c b/src/network/io.c
> index 5c85b99798..8499a5dd37 100644
> --- a/src/network/io.c
> +++ b/src/network/io.c
> @@ -421,7 +421,7 @@ ssize_t (net_Write)(vlc_object_t *obj, int fd, const void *buf, size_t len)
>               return -1;
>           }
>   
> -        ssize_t val = vlc_send_i11e (fd, buf, len, MSG_NOSIGNAL);
> +        ssize_t val = vlc_send_i11e(fd, buf, len, 0);
>           if (val == -1)
>           {
>               if (errno == EINTR || errno == EAGAIN)
> diff --git a/src/network/stream.c b/src/network/stream.c
> index 5a24bd7134..5c2ddac1a6 100644
> --- a/src/network/stream.c
> +++ b/src/network/stream.c
> @@ -200,7 +200,7 @@ static ssize_t vlc_tls_SocketWrite(vlc_tls_t *tls, const struct iovec *iov,
>           .msg_iovlen = count,
>       };
>   
> -    return sendmsg(sock->fd, &msg, MSG_NOSIGNAL);
> +    return vlc_sendmsg(sock->fd, &msg, 0);
>   }
>   
>   static int vlc_tls_SocketShutdown(vlc_tls_t *tls, bool duplex)
> @@ -371,7 +371,7 @@ static ssize_t vlc_tls_ConnectWrite(vlc_tls_t *tls,
>       };
>       ssize_t ret;
>   
> -    ret = sendmsg(sock->fd, &msg, MSG_NOSIGNAL|MSG_FASTOPEN);
> +    ret = vlc_sendmsg(sock->fd, &msg, MSG_FASTOPEN);
>       if (ret >= 0)
>       {   /* Fast open in progress */
>           return ret;
> diff --git a/src/posix/filesystem.c b/src/posix/filesystem.c
> index 89782a4bc2..60a997d9e0 100644
> --- a/src/posix/filesystem.c
> +++ b/src/posix/filesystem.c
> @@ -51,6 +51,9 @@ static inline void vlc_cloexec(int fd)
>       fcntl(fd, F_SETFD, FD_CLOEXEC | fcntl(fd, F_GETFD));
>   }
>   #endif
> +#if !defined(MSG_NOSIGNAL) && defined(SO_NOSIGPIPE)
> +# define MSG_NOSIGNAL 0
> +#endif
>   
>   int vlc_open (const char *filename, int flags, ...)
>   {
> -- 
> 2.26.0
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list