Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/ssl_openssl.c

    r8a2221a7 r9730d72  
    5757
    5858
     59void ssl_init( void )
     60{
     61        initialized = TRUE;
     62        SSLeay_add_ssl_algorithms();
     63}
     64
    5965void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
    6066{
     
    6268       
    6369        conn->fd = proxy_connect( host, port, ssl_connected, conn );
    64         if( conn->fd < 0 )
    65         {
    66                 g_free( conn );
    67                 return NULL;
    68         }
    69        
    7070        conn->func = func;
    7171        conn->data = data;
    7272        conn->inpa = -1;
     73       
     74        if( conn->fd < 0 )
     75        {
     76                g_free( conn );
     77                return NULL;
     78        }
    7379       
    7480        return conn;
     
    115121        if( !initialized )
    116122        {
    117                 initialized = TRUE;
    118                 SSLeay_add_ssl_algorithms();
     123                ssl_init();
    119124        }
    120125       
     
    231236}
    232237
    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. */
    242 int 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 
    248238void ssl_disconnect( void *conn_ )
    249239{
Note: See TracChangeset for help on using the changeset viewer.