[Spice-devel] [PATCH] Delay the exit call for the exit on disconnect function.

Pavel Grunt pgrunt at redhat.com
Thu Nov 3 09:58:56 UTC 2016


moving it down can cause server to not exit in case client==NULL

OT: if we consider multiple client connections
(SPICE_DEBUG_ALLOW_MC=1) than it is still leaking

Pavel

On Wed, 2016-11-02 at 10:42 -0500, Jeremy White wrote:
> This will allow client cleanup to happen.
> 
> Signed-off-by: Jeremy White <jwhite at codeweavers.com>
> ---
>  server/reds.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/server/reds.c b/server/reds.c
> index c235421..e380dd1 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -559,12 +559,6 @@ void reds_client_disconnect(RedsState *reds,
> RedClient *client)
>  {
>      RedsMigTargetClient *mig_client;
>  
> -    if (reds->config->exit_on_disconnect)
> -    {
> -        spice_info("Exiting server because of client
> disconnect.\n");
> -        exit(0);
> -    }
> -
>      if (!client || client->disconnecting) {
>          spice_debug("client %p already during disconnection",
> client);
>          return;
> @@ -599,6 +593,12 @@ void reds_client_disconnect(RedsState *reds,
> RedClient *client)
>      reds->num_clients--;
>      red_client_destroy(client);
>  
> +    if (reds->config->exit_on_disconnect)
> +    {
> +        spice_info("Exiting server because of client
> disconnect.\n");
> +        exit(0);
> +    }
> +
>     // TODO: we need to handle agent properly for all clients!!!!
> (e.g., cut and paste, how? Maybe throw away messages
>     // if we are in the middle of one from another client)
>      if (reds->num_clients == 0) {


More information about the Spice-devel mailing list