On Mon, May 11, 2020 at 10:00:42PM +0200, Lukas Straub wrote: > On Mon, 11 May 2020 12:51:46 +0100 > Daniel P. Berrangé <berra...@redhat.com> wrote: > > > On Mon, May 11, 2020 at 01:14:41PM +0200, Lukas Straub wrote: > > > Add qio_channel_set_yank function to channel and to channel-socket, > > > which will register a yank function. The yank function calls > > > shutdown() on the socket. > > > > > > Signed-off-by: Lukas Straub <lukasstra...@web.de> > > > --- > > > Makefile.objs | 1 + > > > include/io/channel-socket.h | 1 + > > > include/io/channel.h | 12 ++++++++++++ > > > io/channel-socket.c | 29 +++++++++++++++++++++++++++++ > > > io/channel.c | 9 +++++++++ > > > 5 files changed, 52 insertions(+) > > > > Assuming we want the yank feature (which I'm not entirely convinced > > of), then I don't think any of this addition should exist. The > > QIOChannel class already provides a "qio_channel_shutdown" method > > which can be invoked. The layer above which is using the QIOChannel > > should be calling this existing qio_channel_shutdown method in > > response to any yank request. The I/O layer shouldn't have any > > direct dependancy on the yank feature. > > Having the code here simplifys the code in the other places.
This introduces a depedancy from the IO channel code into the system emulator infra which is not desired. The goal is to keep the io/ module isolated and as self-contained as possible. I don't think it makes a significant difference to the yank code to keep it out of the io layer, and simply call the QIOChannel objects via their existing public API. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|