[Spice-devel] [spice-server 1/3] reds-stream: Introduce reds_stream_set_no_delay() helper

Frediano Ziglio fziglio at redhat.com
Thu Mar 9 11:12:47 UTC 2017


> 
> On Thu, Mar 09, 2017 at 05:37:06AM -0500, Frediano Ziglio wrote:
> > > 
> > > The code to enable/disable on a TCP socket is duplicated in multiple
> > > places in the code base, this commit replaces this duplicated code with
> > > a helper in RedsStream.
> > > ---
> > > 
> > > This patch has already been sent a few times with various variations
> > > around
> > > bool/gboolean/true/TRUE. I'd like to stick with things as they are in
> > > this
> > > patch now as this is consistent with the rest of the reds-stream.c code.
> > > 
> > 
> > I would prefer to have a patch to fix the incoherences in reds-stream.c
> > before.
> 
> I have such a patch queued, but it comes after this series, and
> I don't really think it's worth rebasing things so that bool comes first
> as long as both issues are fixed in the next days.
> > 
> > But beside this I think these function would be better into a new file
> > dealing with lower level sockets instead of RedsStream.
> 
> That's a good point, red-socket.c? Though if it grows too close to
> GSocket, I'd probably just use that.
> 

They are so low level that even the red prefix is strong (at least in
file name).
Maybe just net-utils.c ?

> > Setting these features on the stream make the function less reusable.
> > For instance the keep alive setting could be even moved to spice-common
> > and reused in the client code.
> 
> The client already uses GSocket for most of this, I don't think it would
> have a use for such an API.
> 

You can use g_socket_get_fd. Looks like these keep alive settings are
not that portable.

> > And for instance you can set no blocking on socket before creating
> > the RedsStream.
> 
> This would make this possible yes, though in this case this did not seem
> that important.
> 
> I'll drop this series then, and see how to do it differently ;)
> 

Looks strong... all I'm suggesting is moving the functions,
change a parameter to int socket and renames them...

> Thanks,
> 
> Christophe
> 

Frediano


More information about the Spice-devel mailing list