comparison 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
comparison
equal deleted inserted replaced
769:b2d4205b0897 770:7577a3afc42d
559 TRACE(("CLOSE readfd %d", channel->readfd)) 559 TRACE(("CLOSE readfd %d", channel->readfd))
560 close(channel->readfd); 560 close(channel->readfd);
561 TRACE(("CLOSE errfd %d", channel->errfd)) 561 TRACE(("CLOSE errfd %d", channel->errfd))
562 close(channel->errfd); 562 close(channel->errfd);
563 563
564 channel->typedata = NULL; 564 if (!channel->close_handler_done
565 && channel->type->closehandler) {
566 channel->type->closehandler(channel);
567 channel->close_handler_done = 1;
568 }
565 569
566 ses.channels[channel->index] = NULL; 570 ses.channels[channel->index] = NULL;
567 m_free(channel); 571 m_free(channel);
568 ses.chancount--; 572 ses.chancount--;
569 573
623 maxlen = MIN(channel->transwindow, channel->transmaxpacket); 627 maxlen = MIN(channel->transwindow, channel->transmaxpacket);
624 /* -(1+4+4) is SSH_MSG_CHANNEL_DATA, channel number, string length, and 628 /* -(1+4+4) is SSH_MSG_CHANNEL_DATA, channel number, string length, and
625 * exttype if is extended */ 629 * exttype if is extended */
626 maxlen = MIN(maxlen, 630 maxlen = MIN(maxlen,
627 ses.writepayload->size - 1 - 4 - 4 - (isextended ? 4 : 0)); 631 ses.writepayload->size - 1 - 4 - 4 - (isextended ? 4 : 0));
628 TRACE(("maxlen %d", maxlen)) 632 TRACE(("maxlen %zd", maxlen))
629 if (maxlen == 0) { 633 if (maxlen == 0) {
630 TRACE(("leave send_msg_channel_data: no window")) 634 TRACE(("leave send_msg_channel_data: no window"))
631 return; 635 return;
632 } 636 }
633 637