From d9b76e981fae89ad0da878cb8bb5b261a9988ddd Mon Sep 17 00:00:00 2001
From: Jeffrey Stedfast <fejj@ximian.com>
Date: Tue, 16 Jan 2001 00:54:18 +0000
Subject: If the close() is successful, set the fd to -1.

2001-01-15  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-stream-fs.c (stream_close): If the close() is successful,
	set the fd to -1.

	* camel-tcp-stream-raw.c: Removed the disconnect() method.
	(stream_close): If the close() is successful, set the sockfd to
	-1.

	* camel-tcp-stream-ssl.c: Removed the disconnect() method.
	(stream_close): If the close() is successful, set the sockfd to
	NULL.

	* camel-tcp-stream.c (camel_tcp_stream_disconnect): Removed,
	easier to just use the close() method as it did the same thing
	anyway.

svn path=/trunk/; revision=7522
---
 camel/camel-tcp-stream-ssl.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

(limited to 'camel/camel-tcp-stream-ssl.c')

diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
index b346a02c61..42255562bc 100644
--- a/camel/camel-tcp-stream-ssl.c
+++ b/camel/camel-tcp-stream-ssl.c
@@ -41,7 +41,6 @@ static int stream_flush  (CamelStream *stream);
 static int stream_close  (CamelStream *stream);
 
 static int stream_connect    (CamelTcpStream *stream, struct hostent *host, int port);
-static int stream_disconnect (CamelTcpStream *stream);
 static int stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data);
 static int stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data);
 
@@ -62,7 +61,6 @@ camel_tcp_stream_ssl_class_init (CamelTcpStreamSSLClass *camel_tcp_stream_ssl_cl
 	camel_stream_class->close = stream_close;
 	
 	camel_tcp_stream_class->connect = stream_connect;
-	camel_tcp_stream_class->disconnect = stream_disconnect;
 	camel_tcp_stream_class->getsockopt = stream_getsockopt;
 	camel_tcp_stream_class->setsockopt = stream_setsockopt;
 }
@@ -160,8 +158,12 @@ stream_flush (CamelStream *stream)
 static int
 stream_close (CamelStream *stream)
 {
-	g_warning ("CamelTcpStreamSSL::close called on a stream where ::disconnect is preferred\n");
-	return PR_Close (((CamelTcpStreamSSL *)stream)->sockfd);
+	if (PR_Close (((CamelTcpStreamSSL *)stream)->sockfd) == PR_Failure)
+		return -1;
+	
+	((CamelTcpStreamSSL *)stream)->sockfd = NULL;
+	
+	return 0;
 }
 
 
@@ -196,11 +198,6 @@ stream_connect (CamelTcpStream *stream, struct hostent *host, int port)
 	return 0;
 }
 
-static int
-stream_disconnect (CamelTcpStream *stream)
-{
-	return PR_Close (((CamelTcpStreamSSL *)stream)->sockfd);
-}
 
 static int
 stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data)
-- 
cgit