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

Marc-André Lureau marcandre.lureau at gmail.com
Wed Feb 12 03:26:54 PST 2014


On Wed, Feb 12, 2014 at 12:21 PM, Christophe Fergeau
<cfergeau at redhat.com> wrote:
>> +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.

My idea is more to get the code in the (2,28) block ready, so that
else #else can be removed without more code churn.

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

nope, but this is all just quite hacky tbh (the whole BIO thingy)..
Hopefully we can move to 2.28 soon.

>
> ACK.
>
> Christophe



-- 
Marc-André Lureau


More information about the Spice-devel mailing list