io: add a "blocking" field to QIOChannelSocket

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 <tejus.gk@nutanix.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Tejus GK 2025-10-24 13:15:42 +00:00 committed by Daniel P. Berrangé
parent 989221c0c7
commit e52d822716
2 changed files with 3 additions and 0 deletions

View file

@ -49,6 +49,7 @@ struct QIOChannelSocket {
socklen_t remoteAddrLen;
ssize_t zero_copy_queued;
ssize_t zero_copy_sent;
bool blocking;
};

View file

@ -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;