Changes in protocols/ssl_gnutls.c [701acdd4:a03a9f3]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/ssl_gnutls.c
r701acdd4 ra03a9f3 38 38 struct scd 39 39 { 40 SslInputFunction func;40 ssl_input_function func; 41 41 gpointer data; 42 42 int fd; … … 51 51 52 52 53 void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data )53 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data ) 54 54 { 55 55 struct scd *conn = g_new0( struct scd, 1 ); … … 111 111 112 112 if( conn->inpa != -1 ) 113 { 113 114 gaim_input_remove( conn->inpa ); 115 conn->inpa = -1; 116 } 114 117 115 118 if( ( st = gnutls_handshake( conn->session ) ) < 0 ) … … 117 120 if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED ) 118 121 { 119 conn->inpa = gaim_input_add( conn->fd, 120 gnutls_record_get_direction( conn->session ) ? 121 GAIM_INPUT_WRITE : GAIM_INPUT_READ, 122 conn->inpa = gaim_input_add( conn->fd, ssl_getdirection( conn ), 122 123 ssl_handshake, data ); 123 124 } … … 145 146 int ssl_read( void *conn, char *buf, int len ) 146 147 { 148 int st; 149 147 150 if( !((struct scd*)conn)->established ) 148 151 { … … 151 154 } 152 155 153 return( gnutls_record_recv( ((struct scd*)conn)->session, buf, len ) ); 154 156 st = gnutls_record_recv( ((struct scd*)conn)->session, buf, len ); 157 158 ssl_errno = SSL_OK; 159 if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED ) 160 ssl_errno = SSL_AGAIN; 161 162 return st; 155 163 } 156 164 157 165 int ssl_write( void *conn, const char *buf, int len ) 158 166 { 167 int st; 168 159 169 if( !((struct scd*)conn)->established ) 160 170 { … … 163 173 } 164 174 165 return( gnutls_record_send( ((struct scd*)conn)->session, buf, len ) ); 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; 166 182 } 167 183 … … 169 185 { 170 186 struct scd *conn = conn_; 187 188 if( conn->inpa != -1 ) 189 gaim_input_remove( conn->inpa ); 171 190 172 191 if( conn->established ) … … 184 203 return( ((struct scd*)conn)->fd ); 185 204 } 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.