aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2006-05-13 21:44:59 +0200
committerWilmer van der Gaast <wilmer@gaast.net>2006-05-13 21:44:59 +0200
commit19ac9c5c98a8d5adf22bcf5b8e2d4141c82a3275 (patch)
tree17a6e17837f36b405b1aff5bf8fc71154d3ad4fc
parent782d988a88582a0f3dd6539664d535fb790df024 (diff)
Timeouts are now persistent.
-rw-r--r--protocols/events_libevent.c11
-rw-r--r--protocols/proxy.c4
-rw-r--r--protocols/ssl_openssl.c6
3 files changed, 14 insertions, 7 deletions
diff --git a/protocols/events_libevent.c b/protocols/events_libevent.c
index d4767348..6e1ed98e 100644
--- a/protocols/events_libevent.c
+++ b/protocols/events_libevent.c
@@ -49,6 +49,7 @@ struct b_event_data
{
guint id;
struct event evinfo;
+ gint timeout;
b_event_handler function;
void *data;
};
@@ -101,6 +102,15 @@ static void b_event_passthrough( int fd, short event, void *data )
event_debug( "Handler returned FALSE: " );
b_event_remove( id );
}
+ else if( fd == -1 )
+ {
+ struct timeval tv;
+
+ tv.tv_sec = b_ev->timeout / 1000;
+ tv.tv_usec = ( b_ev->timeout % 1000 ) * 1000;
+
+ evtimer_add( &b_ev->evinfo, &tv );
+ }
}
gint b_input_add( gint fd, b_input_condition condition, b_event_handler function, gpointer data )
@@ -158,6 +168,7 @@ gint b_timeout_add( gint timeout, b_event_handler function, gpointer data )
struct timeval tv;
b_ev->id = id_next++;
+ b_ev->timeout = timeout;
b_ev->function = function;
b_ev->data = data;
diff --git a/protocols/proxy.c b/protocols/proxy.c
index d6f3a4ca..b8aa304d 100644
--- a/protocols/proxy.c
+++ b/protocols/proxy.c
@@ -125,7 +125,9 @@ static int proxy_connect_none(const char *host, unsigned short port, struct PHB
}
sock_make_nonblocking(fd);
-
+
+ event_debug("proxy_connect_none( \"%s\", %d ) = %d\n", host, port, fd);
+
if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0) {
if (sockerr_again()) {
phb->inpa = b_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb);
diff --git a/protocols/ssl_openssl.c b/protocols/ssl_openssl.c
index 5aa0263e..b6f6c520 100644
--- a/protocols/ssl_openssl.c
+++ b/protocols/ssl_openssl.c
@@ -114,12 +114,6 @@ static gboolean ssl_handshake( gpointer data, gint source, b_input_condition con
struct scd *conn = data;
int st;
- if( 0 && conn->inpa != -1 )
- {
- b_event_remove( conn->inpa );
- conn->inpa = -1;
- }
-
if( ( st = SSL_connect( conn->ssl ) ) < 0 )
{
conn->lasterr = SSL_get_error( conn->ssl, st );