Browse Source

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>
pull/307/head
Tejus GK 10 months ago
committed by Daniel P. Berrangé
parent
commit
e52d822716
  1. 1
      include/io/channel-socket.h
  2. 2
      io/channel-socket.c

1
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;
};

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

Loading…
Cancel
Save