Ignore:
Timestamp:
2005-12-17T20:56:50Z (19 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
a03a9f3
Parents:
b5a22e3 (diff), ad8b8a3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Moved HTTP-stuff (right now only for passport) into a separate module. This
all works 100% asynchronous and non-blocking, so almost all I/O in BitlBee
should be completely non-blocking now!

Right now support for other modules than GnuTLS is probably broken, I'll fix
it later.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/ssl_gnutls.c

    rb5a22e3 r7c0a497  
    3838struct scd
    3939{
    40         SslInputFunction func;
     40        ssl_input_function func;
    4141        gpointer data;
    4242        int fd;
     
    5151
    5252
    53 void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data )
     53void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
    5454{
    5555        struct scd *conn = g_new0( struct scd, 1 );
     
    117117                if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED )
    118118                {
    119                         conn->inpa = gaim_input_add( conn->fd,
    120                                                      gnutls_record_get_direction( conn->session ) ?
    121                                                          GAIM_INPUT_WRITE : GAIM_INPUT_READ,
     119                        conn->inpa = gaim_input_add( conn->fd, ssl_getdirection( conn ),
    122120                                                     ssl_handshake, data );
    123121                }
     
    145143int ssl_read( void *conn, char *buf, int len )
    146144{
     145        int st;
     146       
    147147        if( !((struct scd*)conn)->established )
    148148        {
     
    151151        }
    152152       
    153         return( gnutls_record_recv( ((struct scd*)conn)->session, buf, len ) );
    154        
     153        st = gnutls_record_recv( ((struct scd*)conn)->session, buf, len );
     154       
     155        ssl_errno = SSL_OK;
     156        if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED )
     157                ssl_errno = SSL_AGAIN;
     158       
     159        return st;
    155160}
    156161
    157162int ssl_write( void *conn, const char *buf, int len )
    158163{
     164        int st;
     165       
    159166        if( !((struct scd*)conn)->established )
    160167        {
     
    163170        }
    164171       
    165         return( gnutls_record_send( ((struct scd*)conn)->session, buf, len ) );
     172        st = gnutls_record_send( ((struct scd*)conn)->session, buf, len );
     173       
     174        ssl_errno = SSL_OK;
     175        if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED )
     176                ssl_errno = SSL_AGAIN;
     177       
     178        return st;
    166179}
    167180
     
    184197        return( ((struct scd*)conn)->fd );
    185198}
     199
     200GaimInputCondition ssl_getdirection( void *conn )
     201{
     202        return( gnutls_record_get_direction( ((struct scd*)conn)->session ) ?
     203                GAIM_INPUT_WRITE : GAIM_INPUT_READ );
     204}
Note: See TracChangeset for help on using the changeset viewer.