Check whether the connection is valid or not when Reset'ting the
authorVeerapuram Varadhan <v.varadhan@gmail.com>
Tue, 16 Sep 2008 12:22:24 +0000 (12:22 -0000)
committerVeerapuram Varadhan <v.varadhan@gmail.com>
Tue, 16 Sep 2008 12:22:24 +0000 (12:22 -0000)
connection.

svn path=/trunk/mcs/; revision=113145

mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog
mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs
mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs

index b5155e53494aeed542570178ed0e5bbb0f8808c3..b54472eccbe238d82cf91dcc90bab816b96786a0 100644 (file)
@@ -1,3 +1,11 @@
+2008-09-16  Veerapuram Varadhan  <vvaradhan@novell.com>
+
+       Patch from Christian Hergert <christian.hergert@gmail.com>
+       * TdsComm.cs: Expose the stream to be internally used by other
+       classes
+       * Tds70.cs (Reset): Validate whether the connection is available
+       or not.
+       
 2008-07-09  Veerapuram Varadhan  <vvaradhan@novell.com>
 
        * TdsComm.cs:  Cleanup stray Console.WriteLine that got in during last commit
index 77521cea00fff8d6593cc77061566ac4f1651ef8..fc47aa87cfdf16d969011b9772356002c328b8fd 100644 (file)
@@ -353,6 +353,11 @@ namespace Mono.Data.Tds.Protocol
 
                public override bool Reset ()
                {
+                       // Check validity of the connection - a false removes
+                       // the connection from the pool
+                       if (!Comm.stream.CanWrite)
+                               return false;
+                       
                        try {
                                ExecProc ("sp_reset_connection");
                                base.Reset ();
index 1e7064e7d66ea4d73f2f51eacdbd85b29f2d5168..7d603d8ad1212eb443e3a48c18455b23b26334e3 100644 (file)
@@ -39,7 +39,7 @@ namespace Mono.Data.Tds.Protocol {
        {
                #region Fields
 
-               NetworkStream stream;
+               internal NetworkStream stream;
                int packetSize;
                TdsPacketType packetType = TdsPacketType.None;
                Encoding encoder;