[Spice-devel] [PATCH 06/18] Add RedsState arg to reds_init_client_[ssl_]connection()

Jonathon Jongsma jjongsma at redhat.com
Wed Feb 10 17:05:55 UTC 2016


On Tue, 2016-02-09 at 05:43 -0500, Frediano Ziglio wrote:
> > 
> > From: Jonathon Jongsma <jjongsma at redhat.com>
> > 
> > ---
> >  server/reds.c | 13 +++++++------
> >  1 file changed, 7 insertions(+), 6 deletions(-)
> > 
> > diff --git a/server/reds.c b/server/reds.c
> > index 6467c7e..7b8848a 100644
> > --- a/server/reds.c
> > +++ b/server/reds.c
> > @@ -2265,7 +2265,7 @@ static void reds_handle_ssl_accept(int fd, int event,
> > void *data)
> >      }
> >  }
> >  
> > -static RedLinkInfo *reds_init_client_connection(int socket)
> > +static RedLinkInfo *reds_init_client_connection(RedsState *reds, int
> > socket)
> >  {
> >      RedLinkInfo *link;
> >      int delay_val = 1;
> > @@ -2318,12 +2318,12 @@ error:
> >  }
> >  
> >  
> > -static RedLinkInfo *reds_init_client_ssl_connection(int socket)
> > +static RedLinkInfo *reds_init_client_ssl_connection(RedsState *reds, int
> > socket)
> >  {
> >      RedLinkInfo *link;
> >      int ssl_status;
> >  
> > -    link = reds_init_client_connection(socket);
> > +    link = reds_init_client_connection(reds, socket);
> >      if (link == NULL)
> >          goto error;
> >  
> > @@ -2354,6 +2354,7 @@ error:
> >  
> >  static void reds_accept_ssl_connection(int fd, int event, void *data)
> >  {
> > +    RedsState *reds = data;



It appears that I made an error and this hunk was incorrectly included in this
patch. This apparently causes a smoketest failure. A later patch in the branch
looks to have the fixes necessary to prevent the crash:

https://cgit.freedesktop.org/~fziglio/spice-server/commit/?h=refactory&id=7b9398
270f21c76e839e06ac279047d517820582

In particular, passing 'reds' as the last argument to watch_add(), instead of
passing NULL.


> >      RedLinkInfo *link;
> >      int socket;
> >  
> > @@ -2362,7 +2363,7 @@ static void reds_accept_ssl_connection(int fd, int
> > event, void *data)
> >          return;
> >      }
> >  
> > -    if (!(link = reds_init_client_ssl_connection(socket))) {
> > +    if (!(link = reds_init_client_ssl_connection(reds, socket))) {
> >          close(socket);
> >          return;
> >      }
> > @@ -2388,7 +2389,7 @@ SPICE_GNUC_VISIBLE int
> > spice_server_add_client(SpiceServer *s, int socket, int s
> >      RedLinkInfo *link;
> >  
> >      spice_assert(reds == s);
> > -    if (!(link = reds_init_client_connection(socket))) {
> > +    if (!(link = reds_init_client_connection(s, socket))) {
> >          spice_warning("accept failed");
> >          return -1;
> >      }
> > @@ -2405,7 +2406,7 @@ SPICE_GNUC_VISIBLE int
> > spice_server_add_ssl_client(SpiceServer *s, int socket, i
> >      RedLinkInfo *link;
> >  
> >      spice_assert(reds == s);
> > -    if (!(link = reds_init_client_ssl_connection(socket))) {
> > +    if (!(link = reds_init_client_ssl_connection(s, socket))) {
> >          return -1;
> >      }
> >  
> 
> Same considerations for naming, use reds instead of s.
> 
> Frediano
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel




More information about the Spice-devel mailing list