Skip to content

Commit

Permalink
network: Set non-blocking mode on Windows too
Browse files Browse the repository at this point in the history
The Windows specific code has the cancellation functionality and the
ability to poll for data implemented, so it can use the non-blocking
mode as well.

Signed-off-by: Paul Cercueil <[email protected]>
  • Loading branch information
pcercuei committed Apr 21, 2022
1 parent b1099c9 commit 1264b85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 0 additions & 6 deletions network-unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ void cleanup_cancel(struct iiod_client_pdata *io_ctx)

int setup_cancel(struct iiod_client_pdata *io_ctx)
{
int ret;

ret = set_blocking_mode(io_ctx->fd, false);
if (ret)
return ret;

return create_cancel_fd(io_ctx);
}

Expand Down
6 changes: 6 additions & 0 deletions network.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ static int network_open(const struct iio_device *dev,
if (ret < 0)
goto err_close_socket;

ret = set_blocking_mode(ppdata->io_ctx.fd, false);
if (ret)
goto err_cleanup_cancel;

set_socket_timeout(ppdata->io_ctx.fd, pdata->io_ctx.timeout_ms);

ppdata->io_ctx.timeout_ms = pdata->io_ctx.timeout_ms;
Expand All @@ -378,6 +382,8 @@ static int network_open(const struct iio_device *dev,

return 0;

err_cleanup_cancel:
cleanup_cancel(&ppdata->io_ctx);
err_close_socket:
close(ppdata->io_ctx.fd);
ppdata->io_ctx.fd = -1;
Expand Down

0 comments on commit 1264b85

Please sign in to comment.