Author: npalani
Date: 2007-12-05 01:49:42 -0500 (Wed, 05 Dec 2007)
New Revision: 90732

Modified:
   trunk/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Connection.cs
Log:
New Excetion has been thrown incase of connection failure.


Modified: 
trunk/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Connection.cs
===================================================================
--- trunk/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Connection.cs   
2007-12-05 01:43:29 UTC (rev 90731)
+++ trunk/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Connection.cs   
2007-12-05 06:49:42 UTC (rev 90732)
@@ -951,18 +951,30 @@
                /* package */
                internal void  writeMessage(Message info)
                {
+                       ExceptionMessages em = new ExceptionMessages();
+                       System.Object [][]contents = em.getContents();
                        messages.Add(info);
                        // For bind requests, if not connected, attempt to 
reconnect
                        if (info.BindRequest && (Connected == false) && 
((System.Object) host != null))
                        {
                                connect(host, port, info.MessageID);
                        }
-                       LdapMessage msg = info.Request;
-                       writeMessage(msg);
-                       return ;
+                       if(Connected == true)
+                       {
+                               LdapMessage msg = info.Request;
+                               writeMessage(msg);
+                               return ;
+                       }
+                       else
+                       {
+                               int errorCount=0;
+                               
for(errorCount=0;errorCount<contents.Length;errorCount++)
+                                       if(contents[errorCount][0] == 
"CONNECTION_CLOSED")
+                                               break;
+                               throw new 
LdapException(ExceptionMessages.CONNECTION_CLOSED, new System.Object[]{host, 
port}, LdapException.CONNECT_ERROR, (String)contents[errorCount][1]);
+                       }
                }
                
-               
                /// <summary> Writes an LdapMessage to the Ldap server over a 
socket.
                /// 
                /// </summary>

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to