diff options
author | dequis <dx@dxzone.com.ar> | 2015-10-21 05:46:02 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-10-21 05:46:02 -0300 |
commit | 72d661eae66d72e26b8050c46403eafc749838fc (patch) | |
tree | 6fcac862ab6a3a10b3c2d1e0347d67eea4832383 | |
parent | 5307e8870a1a4aea9da534b009190246a8b6e9f0 (diff) |
yahoo: Fix handling of proxy connection failures
Fixes trac ticket 135, https://bugs.bitlbee.org/bitlbee/ticket/135
The ticket mentions 100% cpu usage when failing to connect to a socks
proxy. It also provides a patch that just checks source == -1 and
disconnects cleanly instead of trying to continue logging in.
This commit is pretty much the same thing, adapted to the API we're
currently using, since the original patch was for bitlbee 1.0.1 and it
looks like the old api was terrible back then.
That ticket was almost 10 years old. The yahoo code didn't change a lot
in that time.
-rw-r--r-- | protocols/yahoo/yahoo.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c index 9da12949..cdbfd24c 100644 --- a/protocols/yahoo/yahoo.c +++ b/protocols/yahoo/yahoo.c @@ -439,8 +439,16 @@ struct byahoo_connect_callback_data { void byahoo_connect_callback(gpointer data, gint source, b_input_condition cond) { struct byahoo_connect_callback_data *d = data; + struct im_connection *ic; - if (!byahoo_get_ic_by_id(d->id)) { + if (!(ic = byahoo_get_ic_by_id(d->id))) { + g_free(d); + return; + } + + if (source == -1) { + imcb_error(ic, "Could not connect to server"); + imc_logout(ic, TRUE); g_free(d); return; } |