Skip to content

Commit 1264b85

Browse files
committed
network: Set non-blocking mode on Windows too
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]>
1 parent b1099c9 commit 1264b85

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

network-unix.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ void cleanup_cancel(struct iiod_client_pdata *io_ctx)
8484

8585
int setup_cancel(struct iiod_client_pdata *io_ctx)
8686
{
87-
int ret;
88-
89-
ret = set_blocking_mode(io_ctx->fd, false);
90-
if (ret)
91-
return ret;
92-
9387
return create_cancel_fd(io_ctx);
9488
}
9589

network.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,10 @@ static int network_open(const struct iio_device *dev,
363363
if (ret < 0)
364364
goto err_close_socket;
365365

366+
ret = set_blocking_mode(ppdata->io_ctx.fd, false);
367+
if (ret)
368+
goto err_cleanup_cancel;
369+
366370
set_socket_timeout(ppdata->io_ctx.fd, pdata->io_ctx.timeout_ms);
367371

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

379383
return 0;
380384

385+
err_cleanup_cancel:
386+
cleanup_cancel(&ppdata->io_ctx);
381387
err_close_socket:
382388
close(ppdata->io_ctx.fd);
383389
ppdata->io_ctx.fd = -1;

0 commit comments

Comments
 (0)