Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/ssl_gnutls.c

    ra03a9f3 r701acdd4  
    3838struct scd
    3939{
    40         ssl_input_function func;
     40        SslInputFunction func;
    4141        gpointer data;
    4242        int fd;
     
    5151
    5252
    53 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
     53void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data )
    5454{
    5555        struct scd *conn = g_new0( struct scd, 1 );
     
    111111       
    112112        if( conn->inpa != -1 )
    113         {
    114113                gaim_input_remove( conn->inpa );
    115                 conn->inpa = -1;
    116         }
    117114       
    118115        if( ( st = gnutls_handshake( conn->session ) ) < 0 )
     
    120117                if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED )
    121118                {
    122                         conn->inpa = gaim_input_add( conn->fd, ssl_getdirection( conn ),
     119                        conn->inpa = gaim_input_add( conn->fd,
     120                                                     gnutls_record_get_direction( conn->session ) ?
     121                                                         GAIM_INPUT_WRITE : GAIM_INPUT_READ,
    123122                                                     ssl_handshake, data );
    124123                }
     
    146145int ssl_read( void *conn, char *buf, int len )
    147146{
    148         int st;
    149        
    150147        if( !((struct scd*)conn)->established )
    151148        {
     
    154151        }
    155152       
    156         st = gnutls_record_recv( ((struct scd*)conn)->session, buf, len );
     153        return( gnutls_record_recv( ((struct scd*)conn)->session, buf, len ) );
    157154       
    158         ssl_errno = SSL_OK;
    159         if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED )
    160                 ssl_errno = SSL_AGAIN;
    161        
    162         return st;
    163155}
    164156
    165157int ssl_write( void *conn, const char *buf, int len )
    166158{
    167         int st;
    168        
    169159        if( !((struct scd*)conn)->established )
    170160        {
     
    173163        }
    174164       
    175         st = gnutls_record_send( ((struct scd*)conn)->session, buf, len );
    176        
    177         ssl_errno = SSL_OK;
    178         if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED )
    179                 ssl_errno = SSL_AGAIN;
    180        
    181         return st;
     165        return( gnutls_record_send( ((struct scd*)conn)->session, buf, len ) );
    182166}
    183167
     
    185169{
    186170        struct scd *conn = conn_;
    187        
    188         if( conn->inpa != -1 )
    189                 gaim_input_remove( conn->inpa );
    190171       
    191172        if( conn->established )
     
    203184        return( ((struct scd*)conn)->fd );
    204185}
    205 
    206 GaimInputCondition ssl_getdirection( void *conn )
    207 {
    208         return( gnutls_record_get_direction( ((struct scd*)conn)->session ) ?
    209                 GAIM_INPUT_WRITE : GAIM_INPUT_READ );
    210 }
Note: See TracChangeset for help on using the changeset viewer.