changeset 26795:baa3867f2281

Don't call jabber_parser_close_stream in jabber_close, it papers over a real issue. As the comment notes and Will pointed out, we should be waiting for the server to send us a </stream:stream> (or a short-ish timeout) before closing the connection. That's both non-trivial and probably requires a major bump.
author Paul Aurich <paul@darkrain42.org>
date Mon, 27 Apr 2009 16:57:26 +0000
parents 4b8eb280d946
children 0e67e1b7581e
files libpurple/protocols/jabber/jabber.c
diffstat 1 files changed, 5 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Mon Apr 27 06:26:28 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Mon Apr 27 16:57:26 2009 +0000
@@ -1350,6 +1350,11 @@
 	jabber_unregister_account_cb(js);
 }
 
+/* TODO: As Will pointed out in IRC, after being notified by the core to
+ * shutdown, we should async. wait for the server to send us the stream
+ * termination before destorying everything. That seems like it would require
+ * changing the semantics of prpl->close(), so it's a good idea for 3.0.0.
+ */
 void jabber_close(PurpleConnection *gc)
 {
 	JabberStream *js = gc->proto_data;
@@ -1364,16 +1369,6 @@
 	if (!gc->disconnect_timeout)
 		jabber_send_raw(js, "</stream:stream>", -1);
 
-	if (!purple_account_get_current_error(purple_connection_get_account(gc))) {
-		/*
-		 * The common case is user-triggered, so we never receive a
-		 * </stream:stream> from the server when disconnecting, so silence the
-		 * parser's warnings. On errors, though, the server terminated the
-		 * connection, so we should have received a real </stream:stream>.
-		 */
-		jabber_parser_close_stream(js);
-	}
-
 	if (js->srv_query_data)
 		purple_srv_cancel(js->srv_query_data);