Re: [PATCH 2/7] Add reds_stream_set_async_error_handler() helper

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

 



Hey,

On Tue, Mar 25, 2014 at 12:00:42PM +0100, Marc-André Lureau wrote:
> Ok, still unused. I am not sure why this should be move higher up in
> classes (why at AsyncRead it wasn't nice enough)?

We can pass the error_handler to each reds_stream_async_read() call, but as
we will be using the same one for all async calls, I preferred to set it
once and for all. AsyncRead is going to be private to reds_stream.c in one
of the next commits, and the error_handler will need to be set from reds.c,
hence the move to a public RedsStream method.

Christophe

> 
> 
> On Mon, Mar 17, 2014 at 2:20 PM, Christophe Fergeau <cfergeau@xxxxxxxxxx>wrote:
> 
> > This replaces async_read_set_error_handler() which was unused. This sets a
> > callback to be called when an async operation fails.
> > ---
> >  server/reds_stream.c | 7 +++----
> >  server/reds_stream.h | 5 ++---
> >  2 files changed, 5 insertions(+), 7 deletions(-)
> >
> > diff --git a/server/reds_stream.c b/server/reds_stream.c
> > index 57eb1d1..cb42561 100644
> > --- a/server/reds_stream.c
> > +++ b/server/reds_stream.c
> > @@ -385,11 +385,10 @@ int reds_stream_enable_ssl(RedsStream *stream,
> > SSL_CTX *ctx)
> >      return reds_stream_ssl_accept(stream);
> >  }
> >
> > -void async_read_set_error_handler(AsyncRead *async,
> > -                                  AsyncReadError error_handler,
> > -                                 void *opaque)
> > +void reds_stream_set_async_error_handler(RedsStream *stream,
> > +                                         AsyncReadError error_handler)
> >  {
> > -    async->error = error_handler;
> > +    stream->priv->async_read.error = error_handler;
> >  }
> >
> >  static inline void async_read_clear_handlers(AsyncRead *obj)
> > diff --git a/server/reds_stream.h b/server/reds_stream.h
> > index 866679a..a5b7a17 100644
> > --- a/server/reds_stream.h
> > +++ b/server/reds_stream.h
> > @@ -39,9 +39,6 @@ typedef struct AsyncRead {
> >  } AsyncRead;
> >
> >  void async_read_handler(int fd, int event, void *data);
> > -void async_read_set_error_handler(AsyncRead *async,
> > -                                  AsyncReadError error_handler,
> > -                                  void *opaque);
> >
> >  typedef struct RedsStreamPrivate RedsStreamPrivate;
> >
> > @@ -67,6 +64,8 @@ typedef enum {
> >  ssize_t reds_stream_read(RedsStream *s, void *buf, size_t nbyte);
> >  void reds_stream_async_read(RedsStream *stream, uint8_t *data, size_t
> > size,
> >                              AsyncReadDone read_done_cb, void *opaque);
> > +void reds_stream_set_async_error_handler(RedsStream *stream,
> > +                                         AsyncReadError error_handler);
> >  ssize_t reds_stream_write(RedsStream *s, const void *buf, size_t nbyte);
> >  ssize_t reds_stream_writev(RedsStream *s, const struct iovec *iov, int
> > iovcnt);
> >  bool reds_stream_write_all(RedsStream *stream, const void *in_buf, size_t
> > n);
> > --
> > 1.8.5.3
> >
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
> >
> 
> 
> 
> -- 
> Marc-André Lureau

Attachment: pgpxKQSoJM3jO.pgp
Description: PGP signature

_______________________________________________
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]