changeset 770:7577a3afc42d

run closehandlers on cleanup
author Matt Johnston <matt@ucc.asn.au>
date Wed, 10 Apr 2013 21:32:55 +0800
parents b2d4205b0897
children a389a2a7aa96
files common-channel.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
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;