io: tls: Add qio_channel_tls_bye

Add a task dispatcher for gnutls_bye similar to the
qio_channel_tls_handshake_task(). The gnutls_bye() call might be
interrupted and so it needs to be rescheduled.

The migration code will make use of this to help the migration
destination identify a premature EOF. Once the session termination is
in place, any EOF that happens before the source issued gnutls_bye()
will be considered an error.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Acked-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
Fabiano Rosas
2025-02-05 13:15:00 -03:00
parent ab1cb3683b
commit 30ee88622e
3 changed files with 101 additions and 0 deletions

View File

@@ -49,8 +49,20 @@ struct QIOChannelTLS {
QCryptoTLSSession *session;
QIOChannelShutdown shutdown;
guint hs_ioc_tag;
guint bye_ioc_tag;
};
/**
* qio_channel_tls_bye:
* @ioc: the TLS channel object
* @errp: pointer to a NULL-initialized error object
*
* Perform the TLS session termination. This method will return
* immediately and the termination will continue in the background,
* provided the main loop is running.
*/
void qio_channel_tls_bye(QIOChannelTLS *ioc, Error **errp);
/**
* qio_channel_tls_new_server:
* @master: the underlying channel object