Skip to content

Commit

Permalink
char: add gio watch fn for tcp backends
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: b50e668c4f4146a654c5d4412440eb9e589f2c02.1362505276.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
  • Loading branch information
Amit Shah authored and Anthony Liguori committed Mar 8, 2013
1 parent e6a87ed commit d3cc5bc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions qemu-char.c
Expand Up @@ -2462,6 +2462,12 @@ static ssize_t tcp_chr_recv(CharDriverState *chr, char *buf, size_t len)
}
#endif

static GSource *tcp_chr_add_watch(CharDriverState *chr, GIOCondition cond)
{
TCPCharDriver *s = chr->opaque;
return g_io_create_watch(s->chan, cond);
}

static gboolean tcp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque)
{
CharDriverState *chr = opaque;
Expand Down Expand Up @@ -2670,6 +2676,7 @@ static CharDriverState *qemu_chr_open_socket_fd(int fd, bool do_nodelay,
chr->chr_close = tcp_chr_close;
chr->get_msgfd = tcp_get_msgfd;
chr->chr_add_client = tcp_chr_add_client;
chr->chr_add_watch = tcp_chr_add_watch;

if (is_listen) {
s->listen_fd = fd;
Expand Down

0 comments on commit d3cc5bc

Please sign in to comment.