[Spice-devel] [PATCH xf86-video-qxl 1/4 v2] Add and remove the vdagent interface as the vdagent actually connects and disconnects.

Christophe Fergeau cfergeau at redhat.com
Tue Oct 20 05:05:38 PDT 2015


On Mon, Oct 19, 2015 at 02:33:55PM -0500, Jeremy White wrote:
> This means that we do not attempt to use agent mouse
> mode if there is no connected agent.
> 
> It fixes a bug which would occur if an agent disconnected
> after session startup which would result in having no
> useful mouse.
> 
> Signed-off-by: Jeremy White <jwhite at codeweavers.com>
> ---
>  src/spiceqxl_vdagent.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/spiceqxl_vdagent.c b/src/spiceqxl_vdagent.c
> index 4208233..315ae53 100644
> --- a/src/spiceqxl_vdagent.c
> +++ b/src/spiceqxl_vdagent.c
> @@ -56,11 +56,12 @@ static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len)
>          if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) {
>              return 0;
>          }
> -        fprintf(stderr, "ERROR: vdagentd died\n");
> +        fprintf(stderr, "ERROR: vdagent died\n");
>          close(virtio_client_fd);
>          virtio_client_fd = -1;
>          vdagent_sin.qxl->core->watch_remove(virtio_client_watch);
>          virtio_client_watch = NULL;
> +        spice_server_remove_interface(&vdagent_sin.base.base);
>      }
>      return nbytes;
>  }
> @@ -120,6 +121,9 @@ static void on_accept(int fd, int event, void *opaque)
>      }
>      virtio_client_watch = qxl->core->watch_add(virtio_client_fd, SPICE_WATCH_EVENT_READ
>          /* TODO - SPICE_WATCH_EVENT_WRITE */, on_read_available, qxl);
> +
> +    spice_server_add_interface(qxl->spice_server, &vdagent_sin.base.base);
> +
>      return;
>  
>  error:
> @@ -167,6 +171,5 @@ void spiceqxl_vdagent_init(qxl_screen_t *qxl)
>          /* TODO - SPICE_WATCH_EVENT_WRITE */, on_accept, qxl);
>  
>      vdagent_sin.base.base.sif = &vmc_interface.base;
> -    spice_server_add_interface(qxl->spice_server, &vdagent_sin.base.base);
>      spiceqxl_uinput_init(qxl);
>  }

Was initially a bit worried at the use of add/remove interface for agent
connection/disconnection, but at least this is sending
AGENT_DISCONNECTED messages to the client, and is probably the best
which can be done with the public API. ACK.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20151020/25e71a5d/attachment-0001.sig>


More information about the Spice-devel mailing list