diff options
author | Miguel de Icaza <miguel@gnome.org> | 2003-10-21 02:16:28 +0400 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2003-10-21 02:16:28 +0400 |
commit | 3e7713768a4e27b77d907ed2e9ebd261b91774df (patch) | |
tree | e41621878b36afc9a97ccec87a40067ca20faec8 /mcs/class/System/System.Net.Sockets | |
parent | 21a24d581f9d7b289f6687b8630045ec25f27686 (diff) |
2003-10-20 Miguel de Icaza <miguel@ximian.com>
* TcpClient.cs: Fix void Dispose (bool disposing) to follow the
pattern. It was shutting down the managed resources even in the
finalizer case, it should only do that when called from
IDisposable.Dipose.
svn path=/trunk/mcs/; revision=19238
Diffstat (limited to 'mcs/class/System/System.Net.Sockets')
-rw-r--r-- | mcs/class/System/System.Net.Sockets/ChangeLog | 9 | ||||
-rwxr-xr-x | mcs/class/System/System.Net.Sockets/TcpClient.cs | 28 |
2 files changed, 23 insertions, 14 deletions
diff --git a/mcs/class/System/System.Net.Sockets/ChangeLog b/mcs/class/System/System.Net.Sockets/ChangeLog index 5c3af0ab2c0..40042a78990 100644 --- a/mcs/class/System/System.Net.Sockets/ChangeLog +++ b/mcs/class/System/System.Net.Sockets/ChangeLog @@ -1,3 +1,10 @@ +2003-10-20 Miguel de Icaza <miguel@ximian.com> + + * TcpClient.cs: Fix void Dispose (bool disposing) to follow the + pattern. It was shutting down the managed resources even in the + finalizer case, it should only do that when called from + IDisposable.Dipose. + 2003-09-11 Lluis Sanchez Gual <lluis@ximian.com> * NetworkStream.cs: Added [In,Out] attributes to Read method. @@ -12,7 +19,7 @@ * UdpClient.cs (Receive): Fix Bug 45633; We should do a blocking call until a datagram is arrives from the remote host. This removes the 512 "magic" buffer size when we did not have any data. - + 2003-07-31 Gonzalo Paniagua Javier <gonzalo@ximian.com> * NetworkStream.cs: diff --git a/mcs/class/System/System.Net.Sockets/TcpClient.cs b/mcs/class/System/System.Net.Sockets/TcpClient.cs index 247443e82eb..e89c9bca75f 100755 --- a/mcs/class/System/System.Net.Sockets/TcpClient.cs +++ b/mcs/class/System/System.Net.Sockets/TcpClient.cs @@ -329,20 +329,22 @@ namespace System.Net.Sockets if (disposed) return; disposed = true; - - // release unmanaged resources - NetworkStream s = stream; - stream = null; - if (s != null) { - // This closes the socket as well, as the NetworkStream - // owns the socket. - s.Close(); - active = false; - s = null; - } else if (client != null){ - client.Close (); + + if (disposing){ + // release managed resources + NetworkStream s = stream; + stream = null; + if (s != null) { + // This closes the socket as well, as the NetworkStream + // owns the socket. + s.Close(); + active = false; + s = null; + } else if (client != null){ + client.Close (); + } + client = null; } - client = null; } /// <summary> |