chardev/char-socket: Properly make qio connections non blocking
In tcp_chr_sync_read function, there is a possibility of socket disconnection during blocking read, then tcp_chr_hup function would clean up the qio channel pointers(i.e ioc, sioc). Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> Message-Id: <1587289900-29485-1-git-send-email-sai.pavan.boddu@xilinx.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
c82d9d43ed
commit
4d1d460248
@ -550,7 +550,9 @@ static int tcp_chr_sync_read(Chardev *chr, const uint8_t *buf, int len)
|
|||||||
|
|
||||||
qio_channel_set_blocking(s->ioc, true, NULL);
|
qio_channel_set_blocking(s->ioc, true, NULL);
|
||||||
size = tcp_chr_recv(chr, (void *) buf, len);
|
size = tcp_chr_recv(chr, (void *) buf, len);
|
||||||
qio_channel_set_blocking(s->ioc, false, NULL);
|
if (s->state != TCP_CHARDEV_STATE_DISCONNECTED) {
|
||||||
|
qio_channel_set_blocking(s->ioc, false, NULL);
|
||||||
|
}
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
/* connection closed */
|
/* connection closed */
|
||||||
tcp_chr_disconnect(chr);
|
tcp_chr_disconnect(chr);
|
||||||
|
Loading…
Reference in New Issue
Block a user