aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2007-12-12 21:36:33 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2007-12-12 21:36:33 +0000
commitd52111a7b05657e4a4fa8417e6655389a50769cf (patch)
tree34725c94ece156484d1812d4da01bb9d01baa35a
parent0f47613a39ad1b5d22d187e63c80c2f70702c217 (diff)
Fixed sockerr_again() usage in Jabber module to (hopefully) fix a 100% CPU
usage bug.
-rw-r--r--lib/misc.c10
-rw-r--r--lib/misc.h2
-rw-r--r--protocols/jabber/io.c4
3 files changed, 14 insertions, 2 deletions
diff --git a/lib/misc.c b/lib/misc.c
index c977029f..d6795ec9 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -44,6 +44,8 @@
#include <resolv.h>
#endif
+#include "ssl_client.h"
+
void strip_linefeed(gchar *text)
{
int i, j;
@@ -590,3 +592,11 @@ char *word_wrap( char *msg, int line_len )
return g_string_free( ret, FALSE );
}
+
+gboolean ssl_sockerr_again( void *ssl )
+{
+ if( ssl )
+ return ssl_errno == SSL_AGAIN;
+ else
+ return sockerr_again();
+}
diff --git a/lib/misc.h b/lib/misc.h
index 1d76f7f2..e0468d73 100644
--- a/lib/misc.h
+++ b/lib/misc.h
@@ -65,4 +65,6 @@ G_MODULE_EXPORT struct ns_srv_reply *srv_lookup( char *service, char *protocol,
G_MODULE_EXPORT char *word_wrap( char *msg, int line_len );
+G_MODULE_EXPORT gboolean ssl_sockerr_again( void *ssl );
+
#endif
diff --git a/protocols/jabber/io.c b/protocols/jabber/io.c
index 61cd142e..29561b86 100644
--- a/protocols/jabber/io.c
+++ b/protocols/jabber/io.c
@@ -119,7 +119,7 @@ static gboolean jabber_write_queue( struct im_connection *ic )
return TRUE;
}
- else if( st == 0 || ( st < 0 && !sockerr_again() ) )
+ else if( st == 0 || ( st < 0 && !ssl_sockerr_again( jd->ssl ) ) )
{
/* Set fd to -1 to make sure we won't write to it anymore. */
closesocket( jd->fd ); /* Shouldn't be necessary after errors? */
@@ -230,7 +230,7 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition
}
}
}
- else if( st == 0 || ( st < 0 && !sockerr_again() ) )
+ else if( st == 0 || ( st < 0 && !ssl_sockerr_again( jd->ssl ) ) )
{
closesocket( jd->fd );
jd->fd = -1;