# HG changeset patch # User Mikael Hallendal # Date 1181492071 -7200 # Node ID 7eb1cedb32416125f4317a8a190f11b96cd820ae # Parent c27883ae51f7a1345dfc1446c45401432d16c836 Run application handlers on stream error. Patch from Owen Taylor that fixes LM-104 where application handlers weren't run on stream error. It also fixes a problem where a variable is incorrectly overwritten. diff -r c27883ae51f7 -r 7eb1cedb3241 loudmouth/lm-connection.c --- a/loudmouth/lm-connection.c Sun Jun 10 18:03:56 2007 +0200 +++ b/loudmouth/lm-connection.c Sun Jun 10 18:14:31 2007 +0200 @@ -287,7 +287,7 @@ } else if (lm_message_get_type (m) == LM_MESSAGE_TYPE_STREAM_ERROR) { connection_stream_error (connection, m); - goto out; + goto run_global_handlers; } id = lm_message_node_get_attribute (m->node, "id"); @@ -306,6 +306,7 @@ goto out; } +run_global_handlers: for (l = connection->handlers[lm_message_get_type (m)]; l && result == LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; l = l->next) { @@ -1463,7 +1464,7 @@ static void connection_stream_error (LmConnection *connection, LmMessage *m) { - LmMessageNode *node; + LmMessageNode *node, *child; g_return_if_fail (connection != NULL); g_return_if_fail (m != NULL); @@ -1471,16 +1472,16 @@ node = m->node; /* Resource conflict */ - node = lm_message_node_get_child (node, "conflict"); - if (node) { + child = lm_message_node_get_child (node, "conflict"); + if (child) { lm_verbose ("Stream error: Conflict (resource connected elsewhere)\n"); connection->disconnect_reason = LM_DISCONNECT_REASON_RESOURCE_CONFLICT; return; } /* XML is crack */ - node = lm_message_node_get_child (node, "xml-not-well-formed"); - if (node) { + child = lm_message_node_get_child (node, "xml-not-well-formed"); + if (child) { lm_verbose ("Stream error: XML not well formed\n"); connection->disconnect_reason = LM_DISCONNECT_REASON_INVALID_XML; return;