Re: [PATCH spice-server 1/3] stream: implement interface for manual flush

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

 



> 
> Hey, I would just squash this with the next commit.
> 

I prefer to keep separate, patch 2/3 is just using the interface for
a possible optimization, for instance it does not touch TLS code
mentioned in this commit message

> On Tue, Jan 16, 2018 at 02:18:13PM +0000, Frediano Ziglio wrote:
> > The writing to network was always immediate.
> > Every write in the stream cause a write to the OS.
> 
> 'causes'
> 
> 
> > This can have some penalty if you don't write large data as network
> > packets can be more fragmented or you encrypt data in smaller chunks
> > (when data are encrypted some padding is added then data is split in
> > multiple of encryption block which is usually the size of encryption
> > key and this is done for every write).
> > Define an interface to allow higher levels code to tell low level when
> > data should be sent to remote or when can wait more data.
> > 
> > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> > ---
> >  server/red-stream.c |  9 +++++++++
> >  server/red-stream.h | 20 ++++++++++++++++++++
> >  2 files changed, 29 insertions(+)
> > 
> > diff --git a/server/red-stream.c b/server/red-stream.c
> > index 8f2c9d32..4812d8e4 100644
> > --- a/server/red-stream.c
> > +++ b/server/red-stream.c
> > @@ -203,6 +203,15 @@ bool red_stream_write_all(RedStream *stream, const
> > void *in_buf, size_t n)
> >      return true;
> >  }
> >  
> > +bool red_stream_set_auto_flush(RedStream *s, bool enable)
> > +{
> > +    return enable;
> > +}
> > +
> > +void red_stream_flush(RedStream *s)
> > +{
> > +}
> > +
> >  #if HAVE_SASL
> >  static ssize_t red_stream_sasl_write(RedStream *s, const void *buf, size_t
> >  nbyte);
> >  #endif
> > diff --git a/server/red-stream.h b/server/red-stream.h
> > index 4d5075ed..7338c75b 100644
> > --- a/server/red-stream.h
> > +++ b/server/red-stream.h
> > @@ -69,6 +69,26 @@ bool red_stream_set_no_delay(RedStream *stream, bool
> > no_delay);
> >  int red_stream_get_no_delay(RedStream *stream);
> >  int red_stream_send_msgfd(RedStream *stream, int fd);
> >  
> > +/**
> > + * Set auto flush flags.
> 
> 'flag'
> 
> > + * If set stream will send data to the underlying socket as
> 
> 'If set, the stream will ...'
> 
> > + * soon as data are written. This is the default.
> > + * If not set you should call red_stream_flush to force
> 
> 'If not set, you should ...'
> 
> > + * data to be sent. Failing to call red_stream_flush on a
> > + * manual flush stream could lead to latency.
> > + * Disabling auto flush can fail while enabling cannot.
> > + *
> > + * Returns true if success or false on failure.
> 
> 'on success' maybe
> 
> 
> Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
> 
> 
> > + */
> > +bool red_stream_set_auto_flush(RedStream *stream, bool enable);
> > +
> > +/**
> > + * Flush data to the underlying socket.
> > + * Calling this function on a stream with auto flush set has
> > + * no result.
> > + */
> > +void red_stream_flush(RedStream *stream);
> > +
> >  typedef enum {
> >      RED_SASL_ERROR_OK,
> >      RED_SASL_ERROR_GENERIC,

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://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]