char: ensure all clients are in non-blocking mode
PATCH 1/1 char: ensure all clients are in non-blocking mode
Only some callers of tcp_chr_new_client are putting the socket client into non-blocking mode. Move the call to qio_channel_set_blocking() into the tcp_chr_new_client method to guarantee that all code paths set non-blocking mode
Reported-by Andrew Baumann <[email protected]>
Reported-by Laurent Vivier <[email protected]>
Signed-off-by Daniel P. Berrange <[email protected]>
--- qemu-char.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
qemu-char.c +2 -1
@@ -3071,6 +3071,8 @@ static int tcp_chr_new_client(CharDriverState *chr, QIOChannelSocket *sioc) s->sioc = sioc;object_ref (OBJECT (sioc)); +qio_channel_set_blocking (s->ioc, false,NULL ); +if (s->do_nodelay) {qio_channel_set_delay (s->ioc, false); }
@@ -3102,7 +3104,6 @@ static int tcp_chr_add_client(CharDriverState *chr, int fd)if (!sioc) {return -1 ; } -qio_channel_set_blocking (QIO_CHANNEL (sioc), false,NULL ); ret =tcp_chr_new_client (chr, sioc);object_unref (OBJECT (sioc));return ret;
Signature · 1 line
2.5.0
Quoted 28 lines · Daniel P. Berrange
Only some callers of
tcp_chr_new_clientare putting the socket client into non-blocking mode. Move the call toqio_channel_set_blocking()into thetcp_chr_new_clientmethod to guarantee that all code paths set non-blocking modeReported-by Andrew Baumann <[email protected]>Reported-by Laurent Vivier <[email protected]>Signed-off-by Daniel P. Berrange <[email protected]>--- qemu-char.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)qemu-char.c +2
-0@@ -3071,6 +3071,8 @@ static int tcp_chr_new_client(CharDriverState *chr, QIOChannelSocket *sioc) s->sioc = sioc;object_ref (OBJECT (sioc)); +qio_channel_set_blocking (s->ioc, false,NULL ); +if (s->do_nodelay) {qio_channel_set_delay (s->ioc, false); }
qemu-char.c static int tcp_chr_add_client(CharDriverState *chr, int fd) · line 3109
Quoted 7 lines
qemu-char.c +0
-1@@ -3102,7 +3104,6 @@ static int tcp_chr_add_client(CharDriverState *chr, int fd)if (!sioc) {return -1 ; } -qio_channel_set_blocking (QIO_CHANNEL (sioc), false,NULL ); ret =tcp_chr_new_client (chr, sioc);object_unref (OBJECT (sioc));return ret;
Thanks, queued.
Paolo