[Spice-devel] [PATCH spice-server v4 09/20] net-utils: Use socket compatibility layer
Marc-André Lureau
marcandre.lureau at gmail.com
Mon Mar 4 18:31:36 UTC 2019
On Wed, Feb 6, 2019 at 2:59 PM Frediano Ziglio <fziglio at redhat.com> wrote:
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
You could easily improve the commit message, as it doesn't seem to do
what it says.
> ---
> server/net-utils.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/server/net-utils.c b/server/net-utils.c
> index 802509a4..ad66a328 100644
> --- a/server/net-utils.c
> +++ b/server/net-utils.c
> @@ -35,6 +35,7 @@
> #include <common/log.h>
>
> #include "net-utils.h"
> +#include "sys-socket.h"
>
> /**
> * red_socket_set_keepalive:
> @@ -101,6 +102,7 @@ bool red_socket_set_no_delay(int fd, bool no_delay)
> */
> bool red_socket_set_non_blocking(int fd, bool non_blocking)
> {
> +#ifndef _WIN32
> int flags;
>
> if ((flags = fcntl(fd, F_GETFL)) == -1) {
> @@ -120,6 +122,15 @@ bool red_socket_set_non_blocking(int fd, bool non_blocking)
> }
>
> return true;
> +#else
Please invert the condition blocks. The code added is specific to WIN32.
> + u_long ioctl_nonblocking = 1;
> +
> + if (ioctlsocket(fd, FIONBIO, &ioctl_nonblocking) != 0) {
> + spice_warning("ioctlsocket(FIONBIO) failed, %d", WSAGetLastError());
> + return false;
> + }
> + return true;
> +#endif
> }
>
> /**
> --
> 2.20.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
--
Marc-André Lureau
More information about the Spice-devel
mailing list