changeset 415:8b9aba1d5fa4 channel-fix

merge of '73fe066c5d9e2395354ba74756124d45c978a04d' and 'f5014cc84558f1e8eba42dbecf9f72f94bfe6134'
author Matt Johnston <matt@ucc.asn.au>
date Tue, 06 Feb 2007 16:00:18 +0000
parents c53a26c430e5 (diff) d482e51447ba (current diff)
children a01c0c8e543a
files common-channel.c libtomcrypt/src/headers/ltc_tommath.h libtomcrypt/src/headers/tommath_class.h libtomcrypt/src/headers/tommath_superclass.h libtomcrypt/src/misc/mpi/is_prime.c libtomcrypt/src/misc/mpi/mpi_to_ltc_error.c libtomcrypt/src/misc/mpi/rand_prime.c libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence.c libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence.c libtomcrypt/src/pk/dh/dh.c libtomcrypt/src/pk/dh/dh_sys.c libtomcrypt/src/pk/ecc/ecc_sys.c libtomcrypt/src/pk/packet_store_header.c libtomcrypt/src/pk/packet_valid_header.c libtomcrypt/testprof/dh_tests.c libtomcrypt/testprof/test.c libtommath/TODO libtommath/logs/sqr.old
diffstat 1 files changed, 0 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/common-channel.c	Sun Feb 04 13:26:04 2007 +0000
+++ b/common-channel.c	Tue Feb 06 16:00:18 2007 +0000
@@ -186,29 +186,6 @@
 	return getchannel_msg(NULL);
 }
 
-/* In order to tell if a writefd is closed, we put it in the readfd FD_SET.
-   We then just try reading a single byte from it. It'll give EAGAIN or something
-   if the socket is still alive (but the FD probably shouldn't be set anyway?)*/
-static void check_closed_writefd(struct Channel* channel, int fd) {
-	char c;
-	int ret;
-	TRACE(("enter check_closed_writefd fd %d", fd))
-	if (fd < 0)	{
-		TRACE(("leave check_closed_writefd."))
-		return;
-	}
-
-	/* Read something. doing read(fd,x,0) seems to become a NOP on some platforms */
-	ret = read(fd, &c, 1);
-	TRACE(("ret %d errno %d", ret, errno))
-	if (ret > 0 || (ret < 0 && (errno == EINTR || errno == EAGAIN)))	{
-		TRACE(("leave check_closed_writefd"))
-		return;
-	}
-	close_chan_fd(channel, fd, SHUT_WR);
-	TRACE(("leave check_closed_writefd after closing %d", fd))
-}
-
 /* Iterate through the channels, performing IO if available */
 void channelio(fd_set *readfds, fd_set *writefds) {
 
@@ -252,16 +229,6 @@
 			writechannel(channel, channel->errfd, channel->extrabuf);
 		}
 	
-		/* Check writefds for close, even if we don't have anything 
-		   to write into them. */
-		if (channel->writefd >= 0) {
-			check_closed_writefd(channel, channel->writefd);
-		}
-		if (ERRFD_IS_WRITE(channel) && channel->errfd >= 0) {
-			check_closed_writefd(channel, channel->errfd);
-		}
-	
-	
 		/* handle any channel closing etc */
 		check_close(channel);
 
@@ -472,16 +439,6 @@
 				FD_SET(channel->errfd, writefds);
 		}
 
-		/* We also set the writefds for reading, so that we will be notified of close */
-		if (channel->writefd >= 0) {
-			FD_SET(channel->writefd, readfds);
-		}		
-		if (ERRFD_IS_WRITE(channel) && channel->errfd >= 0) {
-			FD_SET(channel->errfd, readfds);
-		}
-		
-		
-
 	} /* foreach channel */
 
 #ifdef USING_LISTENERS