Changeset 8a2221a7 for lib/ssl_openssl.c


Ignore:
Timestamp:
2008-03-23T14:29:19Z (16 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
dd14ecc
Parents:
851a8c2
Message:

Fixed stalling issue with OpenSSL and Jabber (#368).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/ssl_openssl.c

    r851a8c2 r8a2221a7  
    6262       
    6363        conn->fd = proxy_connect( host, port, ssl_connected, conn );
     64        if( conn->fd < 0 )
     65        {
     66                g_free( conn );
     67                return NULL;
     68        }
     69       
    6470        conn->func = func;
    6571        conn->data = data;
    6672        conn->inpa = -1;
    67        
    68         if( conn->fd < 0 )
    69         {
    70                 g_free( conn );
    71                 return NULL;
    72         }
    7373       
    7474        return conn;
     
    231231}
    232232
     233/* Only OpenSSL *really* needs this (and well, maybe NSS). See for more info:
     234   http://www.gnu.org/software/gnutls/manual/gnutls.html#index-gnutls_005frecord_005fcheck_005fpending-209
     235   http://www.openssl.org/docs/ssl/SSL_pending.html
     236   
     237   Required because OpenSSL empties the TCP buffer completely but doesn't
     238   necessarily give us all the unencrypted data.
     239   
     240   Returns 0 if there's nothing left or if we don't have to care (GnuTLS),
     241   1 if there's more data. */
     242int ssl_pending( void *conn )
     243{
     244        return ( ((struct scd*)conn) && ((struct scd*)conn)->established ) ?
     245               SSL_pending( ((struct scd*)conn)->ssl ) > 0 : 0;
     246}
     247
    233248void ssl_disconnect( void *conn_ )
    234249{
Note: See TracChangeset for help on using the changeset viewer.