Re: [PATCH spice-server 06/10] reds: disconnect the session when an essential channel is disconnected

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/08/2013 10:46 AM, Marc-André Lureau wrote:
What is the motivation for doing that? The client could want to save
bandwidth by closing a display channel, or he might want to disable all
inputs temporarily.

If these channels were already connected, I believe it is better to close the client, than having the user don't understand why suddenly the display is frozen, or why his keyboard and mouse don't work.
And also, similarly, do you think the server should enforce that the
client connect to all the mandatory channels? And how?

I'm not sure we should enforce them, but if they were already connected, I don't think they should be disconnected independently.

On Wed, May 8, 2013 at 4:06 PM, Yonit Halperin <yhalperi@xxxxxxxxxx
<mailto:yhalperi@xxxxxxxxxx>> wrote:

    ---
      server/reds.c | 25 +++++++++++++++++++++++++
      1 file changed, 25 insertions(+)

    diff --git a/server/reds.c b/server/reds.c
    index f6a1ce9..38923b0 100644
    --- a/server/reds.c
    +++ b/server/reds.c
    @@ -194,12 +194,37 @@ static void
    reds_stream_push_channel_event(RedsStream *s, int event)
          main_dispatcher_channel_event(event, s->info);
      }

    +static const int mandatory_channels[] = {SPICE_CHANNEL_MAIN,
    SPICE_CHANNEL_DISPLAY, SPICE_CHANNEL_INPUTS};
    +
    +static int channel_is_mandatory(int type)
    +{
    +    int i;
    +    for (i = 0 ; i <
    sizeof(mandatory_channels)/sizeof(mandatory_channels[0]); ++i) {
    +        if (type == mandatory_channels[i]) {
    +            return TRUE;
    +        }
    +    }
    +    return FALSE;
    +}
    +
      void reds_handle_channel_event(int event, SpiceChannelEventInfo *info)
      {
          if (core->base.minor_version >= 3 && core->channel_event != NULL)
              core->channel_event(event, info);

          if (event == SPICE_CHANNEL_EVENT_DISCONNECTED) {
    +        if (channel_is_mandatory(info->type) && reds->main_channel) {
    +            RedClient *client =
    main_channel_get_client_by_link_id(reds->main_channel,
    +
    info->connection_id);
    +            /* if client == NULL, it means that main channel has
    already been disconnected.
    +             * and since main channel is a mandatory channel,
    reds_client_disconnect has
    +             * already been called */
    +            if (client) {
    +                spice_debug("client %p: mandatory channel (type %d
    id %d)"
    +                            " has disconnected; closing session",
    client, info->type, info->id);
    +                reds_client_disconnect(client);
    +            }
    +        }
              free(info);
          }
      }
    --
    1.8.1.4

    _______________________________________________
    Spice-devel mailing list
    Spice-devel@xxxxxxxxxxxxxxxxxxxxx
    <mailto:Spice-devel@xxxxxxxxxxxxxxxxxxxxx>
    http://lists.freedesktop.org/mailman/listinfo/spice-devel




--
Marc-André Lureau

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]