[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [RFC][RESEND][PATCH v1 05/15] virtproxy: add accept han
From: |
Adam Litke |
Subject: |
[Qemu-devel] Re: [RFC][RESEND][PATCH v1 05/15] virtproxy: add accept handler for communication channel |
Date: |
Wed, 03 Nov 2010 18:02:09 -0500 |
On Wed, 2010-11-03 at 10:28 -0500, Michael Roth wrote:
> This accept()'s connections to the socket we told virt-proxy to listen
> for the channel connection on and sets the appropriate read handler for
> the resulting FD.
>
> Signed-off-by: Michael Roth <address@hidden>
> ---
> virtproxy.c | 37 +++++++++++++++++++++++++++++++++++++
> 1 files changed, 37 insertions(+), 0 deletions(-)
>
> diff --git a/virtproxy.c b/virtproxy.c
> index fa17722..20532c2 100644
> --- a/virtproxy.c
> +++ b/virtproxy.c
> @@ -166,6 +166,8 @@ static VPConn *get_conn(const VPDriver *drv, int fd, bool
> client)
> return NULL;
> }
>
> +static void vp_channel_accept(void *opaque);
> +
Why the forward declaration? Can you move the function to a different
place in the file to avoid this?
> +/* accept handler for communication channel
> + *
> + * accept()s connection to communication channel (for sockets), and sets
> + * up the read handler for resulting FD.
> + */
> +static void vp_channel_accept(void *opaque)
> +{
> + VPDriver *drv = opaque;
> + struct sockaddr_in saddr;
> + struct sockaddr *addr;
> + socklen_t len;
> + int fd;
> +
> + TRACE("called with opaque: %p", drv);
> +
> + for(;;) {
> + len = sizeof(saddr);
> + addr = (struct sockaddr *)&saddr;
> + fd = qemu_accept(drv->listen_fd, addr, &len);
> +
> + if (fd < 0 && errno != EINTR) {
> + TRACE("accept() failed");
> + return;
> + } else if (fd >= 0) {
> + TRACE("accepted connection");
> + break;
> + }
> + }
> +
> + drv->channel_fd = fd;
> + vp_set_fd_handler(drv->channel_fd, vp_channel_read, NULL, drv);
> + /* dont accept anymore connections until channel_fd is closed */
> + vp_set_fd_handler(drv->listen_fd, NULL, NULL, NULL);
> +}
--
Thanks,
Adam
- [Qemu-devel] Re: [RFC][RESEND][PATCH v1 02/15] virtproxy: qemu-vp, standalone daemon skeleton, (continued)
[Qemu-devel] [RFC][RESEND][PATCH v1 01/15] virtproxy: base data structures and constants, Michael Roth, 2010/11/03
[Qemu-devel] [RFC][RESEND][PATCH v1 03/15] virtproxy: add debug functions for virtproxy core, Michael Roth, 2010/11/03
[Qemu-devel] [RFC][RESEND][PATCH v1 04/15] virtproxy: list look-up functions conns/oforwards/iforwards, Michael Roth, 2010/11/03
[Qemu-devel] [RFC][RESEND][PATCH v1 05/15] virtproxy: add accept handler for communication channel, Michael Roth, 2010/11/03
- [Qemu-devel] Re: [RFC][RESEND][PATCH v1 05/15] virtproxy: add accept handler for communication channel,
Adam Litke <=
[Qemu-devel] [RFC][RESEND][PATCH v1 08/15] virtproxy: interfaces to set/remove/handle VPOForwards, Michael Roth, 2010/11/03
[Qemu-devel] [RFC][RESEND][PATCH v1 09/15] virtproxy: add handler for data packets, Michael Roth, 2010/11/03
[Qemu-devel] [RFC][RESEND][PATCH v1 10/15] virtproxy: add handler for control packet, Michael Roth, 2010/11/03
[Qemu-devel] [RFC][RESEND][PATCH v1 14/15] virtproxy: Makefile/configure changes to build qemu-vp, Michael Roth, 2010/11/03
[Qemu-devel] [RFC][RESEND][PATCH v1 11/15] virtproxy: add vp_handle_packet(), Michael Roth, 2010/11/03