comparison common-channel.c @ 423:b2b67cfcd66e channel-fix

- Fix bug in child-exit handling where the wrong pid was being matched. - Also wait for errfd to close before closing the channel
author Matt Johnston <matt@ucc.asn.au>
date Mon, 12 Feb 2007 10:39:22 +0000
parents a01c0c8e543a
children c216212001fc
comparison
equal deleted inserted replaced
422:a9e0ddac5ba7 423:b2b67cfcd66e
311 } 311 }
312 312
313 /* And if we can't receive any more data from them either, close up */ 313 /* And if we can't receive any more data from them either, close up */
314 if (!channel->sent_close 314 if (!channel->sent_close
315 && channel->readfd == FD_CLOSED 315 && channel->readfd == FD_CLOSED
316 && (ERRFD_IS_WRITE(channel) || channel->errfd == FD_CLOSED)
316 && !write_pending(channel)) { 317 && !write_pending(channel)) {
317 TRACE(("sending close, readfd is closed")) 318 TRACE(("sending close, readfd is closed"))
318 send_msg_channel_close(channel); 319 send_msg_channel_close(channel);
319 } 320 }
320 } 321 }
622 time we expect to receive EAGAIN is when we're flushing a FD, 623 time we expect to receive EAGAIN is when we're flushing a FD,
623 in which case it can be treated the same as EOF */ 624 in which case it can be treated the same as EOF */
624 close_chan_fd(channel, fd, SHUT_RD); 625 close_chan_fd(channel, fd, SHUT_RD);
625 } 626 }
626 ses.writepayload->len = ses.writepayload->pos = 0; 627 ses.writepayload->len = ses.writepayload->pos = 0;
627 TRACE(("leave send_msg_channel_data: len %d read err or EOF for fd %d", 628 TRACE(("leave send_msg_channel_data: len %d read err %d or EOF for fd %d",
628 len, channel->index)); 629 len, errno, fd))
629 return; 630 return;
630 } 631 }
631 buf_incrwritepos(ses.writepayload, len); 632 buf_incrwritepos(ses.writepayload, len);
632 /* ... real size here */ 633 /* ... real size here */
633 buf_setpos(ses.writepayload, size_pos); 634 buf_setpos(ses.writepayload, size_pos);