Possible bug-fixing in rr-manager handle_incoming_close_rpy

"David Marín Carreño" <[email protected]> Sun, 12 Jan 2003 12:18:39 +0100 (CET)
Newsgroups gmane.network.beep.roadrunner.general
Message-ID <[email protected]>
When I try to close a channel, the closer locks waiting an incoming closerpy.

After debugging a bit, I've seen that handle_incoming_close_rpy doesn't
works well: it runs, but it never comes to rr_message_close_done.
static void
handle_incoming_closerpy (RRManager *manager, RRMessageClose *close,
			  RRFrame *frame, GError **error)
{

	RRChannel *channel;
	RRConnection *conn = RR_CHANNEL (manager)->connection;

	channel = rr_connection_get_channel (conn, close->channelnumber);
	g_return_if_fail (RR_IS_CHANNEL (channel));

	rr_channel_close_confirmation (channel, close->code,
				       close->xml_lang,
				       close->diagnostic);

	rr_connection_remove_channel (conn, channel);

	rr_message_close_done (close, NULL);

	g_object_unref (G_OBJECT (close));
}


It locks when calling rr_connection_remove_channel... Perhaps because
rr_message_close continues depending on the channel.
I've swapped the order of these lines:

static void
handle_incoming_closerpy (RRManager *manager, RRMessageClose *close,
			  RRFrame *frame, GError **error)
{

	RRChannel *channel;
	RRConnection *conn = RR_CHANNEL (manager)->connection;

	channel = rr_connection_get_channel (conn, close->channelnumber);
	g_return_if_fail (RR_IS_CHANNEL (channel));

	rr_channel_close_confirmation (channel, close->code,
				       close->xml_lang,
				       close->diagnostic);

	rr_message_close_done (close, NULL);

	rr_connection_remove_channel (conn, channel);

	g_object_unref (G_OBJECT (close));
}

And now it works: nothing is get locked without end, and both
handle_incoming_closerpy and rr_manager_close_channel.
I don't know if I have broken something else, but now it seems I can close
channels.

Greetings.