[Spice-devel] [spice-gtk 08/13] openssl: learn to handle a new kind of BIO based on GIOStream

Christophe Fergeau cfergeau at redhat.com
Wed Feb 12 03:21:40 PST 2014


On Mon, Feb 03, 2014 at 07:02:39PM +0100, Marc-André Lureau wrote:
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
> 
> Although reusing BIO_new_socket() once again is a hack, it seems
> to be the easiest way... The proper solution is certainly to start
> using GTls instead, but that will require a glib 2.28 dep bump.

Ah, much easier to review with git show -M (rename detection). 
> +
> +G_GNUC_INTERNAL
> +#if GLIB_CHECK_VERSION(2, 28, 0)
> +BIO* bio_new_giostream(GIOStream *stream)
> +{
> +    // TODO: make an actual new BIO type, or just switch to GTls already...
> +    BIO *bio = BIO_new_socket(-1, BIO_NOCLOSE);
> +#else
> +BIO* bio_new_gsocket(GSocket *gsocket)
> +{
> +    BIO *bio = BIO_new_socket(g_socket_get_fd(gsocket), BIO_NOCLOSE);
> +#endif

This #if block is not quite readable, I probably would have split that in a
helper function with the common code + 2 #ifdef'ed
bio_new_giostream/bio_new_gsocket calling that helper.

BIO_new_socket() will not mind having its fd set to -1 ?

ACK.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20140212/608ef71a/attachment.pgp>


More information about the Spice-devel mailing list