diff common-channel.c @ 770:7577a3afc42d

run closehandlers on cleanup
author Matt Johnston <matt@ucc.asn.au>
date Wed, 10 Apr 2013 21:32:55 +0800
parents 9a5438271556
children 35183e8a7851
line wrap: on
line diff
--- a/common-channel.c	Wed Apr 10 21:32:44 2013 +0800
+++ b/common-channel.c	Wed Apr 10 21:32:55 2013 +0800
@@ -561,7 +561,11 @@
 	TRACE(("CLOSE errfd %d", channel->errfd))
 	close(channel->errfd);
 
-	channel->typedata = NULL;
+	if (!channel->close_handler_done
+		&& channel->type->closehandler) {
+		channel->type->closehandler(channel);
+		channel->close_handler_done = 1;
+	}
 
 	ses.channels[channel->index] = NULL;
 	m_free(channel);
@@ -625,7 +629,7 @@
 	 * exttype if is extended */
 	maxlen = MIN(maxlen, 
 			ses.writepayload->size - 1 - 4 - 4 - (isextended ? 4 : 0));
-	TRACE(("maxlen %d", maxlen))
+	TRACE(("maxlen %zd", maxlen))
 	if (maxlen == 0) {
 		TRACE(("leave send_msg_channel_data: no window"))
 		return;