[Mono-list] [PATCH] BufferedStream.cs

Carlos Guzmán Álvarez carlosga@telefonica.net
Wed, 20 Nov 2002 12:12:50 +0100


This is a multi-part message in MIME format.
--------------090107010507080904010903
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Hello:


This patch fix a problem closing a bufferedstream that uses a 
networkstream, the problem gives when bufferedstream try to get the 
value of the property Position of the networkstream, this property on 
networkstream will throw always an exeption(this is correct).

The same thing with csc works well.




Best regards
Carlos Guzmán Álvarez
Vigo-Spain



P.S.: I use GetType().FullName instead of is because using the last mcs 
don´t build.

--------------090107010507080904010903
Content-Type: text/plain;
 name="patch.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch.txt"

Index: BufferedStream.cs
===================================================================
RCS file: /mono/mcs/class/corlib/System.IO/BufferedStream.cs,v
retrieving revision 1.2
diff -u -r1.2 BufferedStream.cs
--- BufferedStream.cs	8 May 2002 13:21:11 -0000	1.2
+++ BufferedStream.cs	20 Nov 2002 10:53:55 -0000
@@ -65,7 +65,9 @@
 
 		public override void Flush() {
 			if (m_buffer_reading) {
-				m_stream.Position = Position;
+				if((m_stream.GetType().FullName != "System.Net.Sockets.NetworkStream")){
+					m_stream.Position = Position;
+				}
 			} else {
 				m_stream.Write(m_buffer, 0, m_buffer_pos);
 			}

--------------090107010507080904010903--