comparison common-channel.c @ 330:5488db2e9e4e

merge of 332f709a4cb39cde4cedab7c3be89e05f3023067 and ca4ca78b82c5d430c69ce01bf794e8886ce81431
author Matt Johnston <matt@ucc.asn.au>
date Sat, 10 Jun 2006 16:39:40 +0000
parents 8ed0dce45126 baea1d43e7eb
children d6b8815a9b5e
comparison
equal deleted inserted replaced
329:8ed0dce45126 330:5488db2e9e4e
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];
253 static void checkclose(struct Channel *channel) { 252 static void checkclose(struct Channel *channel) {
254 253
255 TRACE(("checkclose: writefd %d, readfd %d, errfd %d, sentclosed %d, recvclosed %d", 254 TRACE(("checkclose: writefd %d, readfd %d, errfd %d, sentclosed %d, recvclosed %d",
256 channel->writefd, channel->readfd, 255 channel->writefd, channel->readfd,
257 channel->errfd, channel->sentclosed, channel->recvclosed)) 256 channel->errfd, channel->sentclosed, channel->recvclosed))
258 TRACE(("writebuf %d extrabuf %s extrabuf %d", 257 TRACE(("writebuf size %d extrabuf ptr 0x%x extrabuf size %d",
259 cbuf_getused(channel->writebuf), 258 cbuf_getused(channel->writebuf),
260 channel->writebuf, 259 channel->writebuf,
261 channel->writebuf ? 0 : cbuf_getused(channel->extrabuf))) 260 channel->writebuf ? 0 : cbuf_getused(channel->extrabuf)))
262 261
263 if (!channel->sentclosed) { 262 if (!channel->sentclosed) {
393 } 392 }
394 393
395 cbuf_incrread(cbuf, len); 394 cbuf_incrread(cbuf, len);
396 channel->recvdonelen += len; 395 channel->recvdonelen += len;
397 396
398 if (fd == channel->writefd && len == maxlen && channel->recveof) { 397 if (fd == channel->writefd && cbuf_getused(cbuf) == 0 && channel->recveof) {
399 /* Check if we're closing up */ 398 /* Check if we're closing up */
400 closewritefd(channel); 399 closewritefd(channel);
401 TRACE(("leave writechannel: recveof set")) 400 TRACE(("leave writechannel: recveof set"))
402 return; 401 return;
403 } 402 }