From: Tejus GK <[email protected]> Add a 'blocking' boolean field to QIOChannelSocket to track whether the underlying socket is in blocking or non-blocking mode.
Signed-off-by: Tejus GK <[email protected]> Reviewed-by: Daniel P. Berrangé <[email protected]> Signed-off-by: Daniel P. Berrangé <[email protected]> --- include/io/channel-socket.h | 1 + io/channel-socket.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/io/channel-socket.h b/include/io/channel-socket.h index a88cf8b3a9..26319fa98b 100644 --- a/include/io/channel-socket.h +++ b/include/io/channel-socket.h @@ -49,6 +49,7 @@ struct QIOChannelSocket { socklen_t remoteAddrLen; ssize_t zero_copy_queued; ssize_t zero_copy_sent; + bool blocking; }; diff --git a/io/channel-socket.c b/io/channel-socket.c index 712b793eaf..8b30d5b7f7 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c @@ -65,6 +65,7 @@ qio_channel_socket_new(void) sioc->fd = -1; sioc->zero_copy_queued = 0; sioc->zero_copy_sent = 0; + sioc->blocking = false; ioc = QIO_CHANNEL(sioc); qio_channel_set_feature(ioc, QIO_CHANNEL_FEATURE_SHUTDOWN); @@ -859,6 +860,7 @@ qio_channel_socket_set_blocking(QIOChannel *ioc, Error **errp) { QIOChannelSocket *sioc = QIO_CHANNEL_SOCKET(ioc); + sioc->blocking = enabled; if (!qemu_set_blocking(sioc->fd, enabled, errp)) { return -1; -- 2.51.1
