Author: gonzalo
Date: 2006-10-30 18:29:15 -0500 (Mon, 30 Oct 2006)
New Revision: 67160

Modified:
   trunk/mcs/class/System/System.Net/ChangeLog
   trunk/mcs/class/System/System.Net/EndPointListener.cs
Log:
2006-10-30 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>

        * EndPointListener.cs: update comment and avoid exception when the
        program is exiting.



Modified: trunk/mcs/class/System/System.Net/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Net/ChangeLog 2006-10-30 23:11:53 UTC (rev 
67159)
+++ trunk/mcs/class/System/System.Net/ChangeLog 2006-10-30 23:29:15 UTC (rev 
67160)
@@ -1,3 +1,8 @@
+2006-10-30 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * EndPointListener.cs: update comment and avoid exception when the
+       program is exiting.
+
 2006-10-30  Miguel de Icaza  <[EMAIL PROTECTED]>
 
        * WebRequestMethods.cs: Another typo fix.

Modified: trunk/mcs/class/System/System.Net/EndPointListener.cs
===================================================================
--- trunk/mcs/class/System/System.Net/EndPointListener.cs       2006-10-30 
23:11:53 UTC (rev 67159)
+++ trunk/mcs/class/System/System.Net/EndPointListener.cs       2006-10-30 
23:29:15 UTC (rev 67160)
@@ -37,7 +37,7 @@
                Dictionary<ListenerPrefix, HttpListener> prefixes;
                List<ListenerPrefix> unhandled; // host = '*'
                List<ListenerPrefix> all; // host = '+'
-               bool secure; // Can a port have listeners for secure and not 
secure at the same time?
+               bool secure; // Can a port have listeners for secure and not 
secure at the same time? No!
 
                public EndPointListener (IPAddress addr, int port, bool secure)
                {
@@ -59,9 +59,20 @@
                        } catch {
                                // Anything to do here?
                        } finally {
-                               epl.sock.BeginAccept (OnAccept, epl);
+                               try {
+                                       epl.sock.BeginAccept (OnAccept, epl);
+                               } catch {
+                                       if (accepted != null) {
+                                               try {
+                                                       accepted.Close ();
+                                               } catch {}
+                                               accepted = null;
+                                       }
+                               } 
                        }
 
+                       if (accepted == null)
+                               return;
                        HttpConnection conn = new HttpConnection (accepted, 
epl, epl.secure);
                        conn.BeginReadRequest ();
                }

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

Reply via email to