comparison common-channel.c @ 399:a707e6148060

merge of '5fdf69ca60d1683cdd9f4c2595134bed26394834' and '6b61c50f4cf888bea302ac8fcf5dbb573b443251'
author Matt Johnston <matt@ucc.asn.au>
date Sat, 03 Feb 2007 08:20:34 +0000
parents 17d097fc111c 59c7938af2bd
children 173a5f89666c
comparison
equal deleted inserted replaced
394:17d097fc111c 399:a707e6148060
179 /* Iterate through the channels, performing IO if available */ 179 /* Iterate through the channels, performing IO if available */
180 void channelio(fd_set *readfds, fd_set *writefds) { 180 void channelio(fd_set *readfds, fd_set *writefds) {
181 181
182 struct Channel *channel; 182 struct Channel *channel;
183 unsigned int i; 183 unsigned int i;
184 int ret;
185 184
186 /* iterate through all the possible channels */ 185 /* iterate through all the possible channels */
187 for (i = 0; i < ses.chansize; i++) { 186 for (i = 0; i < ses.chansize; i++) {
188 187
189 channel = ses.channels[i]; 188 channel = ses.channels[i];
235 static void checkclose(struct Channel *channel) { 234 static void checkclose(struct Channel *channel) {
236 235
237 TRACE(("checkclose: writefd %d, readfd %d, errfd %d, sentclosed %d, recvclosed %d", 236 TRACE(("checkclose: writefd %d, readfd %d, errfd %d, sentclosed %d, recvclosed %d",
238 channel->writefd, channel->readfd, 237 channel->writefd, channel->readfd,
239 channel->errfd, channel->sentclosed, channel->recvclosed)) 238 channel->errfd, channel->sentclosed, channel->recvclosed))
240 TRACE(("writebuf %d extrabuf %s extrabuf %d", 239 TRACE(("writebuf size %d extrabuf ptr 0x%x extrabuf size %d",
241 cbuf_getused(channel->writebuf), 240 cbuf_getused(channel->writebuf),
242 channel->writebuf, 241 channel->writebuf,
243 channel->writebuf ? 0 : cbuf_getused(channel->extrabuf))) 242 channel->writebuf ? 0 : cbuf_getused(channel->extrabuf)))
244 243
245 if (!channel->sentclosed) { 244 if (!channel->sentclosed) {
375 } 374 }
376 375
377 cbuf_incrread(cbuf, len); 376 cbuf_incrread(cbuf, len);
378 channel->recvdonelen += len; 377 channel->recvdonelen += len;
379 378
380 if (fd == channel->writefd && len == maxlen && channel->recveof) { 379 if (fd == channel->writefd && cbuf_getused(cbuf) == 0 && channel->recveof) {
381 /* Check if we're closing up */ 380 /* Check if we're closing up */
382 closewritefd(channel); 381 closewritefd(channel);
383 TRACE(("leave writechannel: recveof set")) 382 TRACE(("leave writechannel: recveof set"))
384 return; 383 return;
385 } 384 }