[Mono-dev] fix for bug #358987 in 1.9?

Zoltan Varga vargaz at gmail.com
Thu Feb 21 06:53:15 EST 2008


Hi,

I applied the following patch instead to the 1.9 branch:

Index: HttpConnection.cs
===================================================================
--- HttpConnection.cs	(revision 96098)
+++ HttpConnection.cs	(working copy)
@@ -313,8 +313,11 @@

 				Socket s = sock;
 				sock = null;
-				s.Shutdown (SocketShutdown.Both);
-				s.Close ();
+				try {
+					s.Shutdown (SocketShutdown.Both);
+				} finally {
+					s.Close ();
+				}
 				if (context_bound)
 					epl.UnbindContext (context);

This is still just a workaround, since the socket should be closed automatically
by its finalizer.

               Zoltan

On Wed, Feb 20, 2008 at 5:37 PM, Avery Pennarun <apenwarr at gmail.com> wrote:
> 2008/2/20 Steve Bjorg <steveb at mindtouch.com>:
>
> > - s.Shutdown (SocketShutdown.Both);
>  > + try {
>  > + s.Shutdown (SocketShutdown.Both);
>  > + } catch(Exception e) {
>  > + // log here?
>  > + }
>  >   s.Close ();
>
>  Why call Shutdown() at all?  The shutdown syscall is only useful if
>  you need to keep the fd around longer (eg. if someone else is still
>  holding onto it and you don't want it to be reused).  In the above
>  code, close() shuts down the socket anyway.
>
>  ...unless mono's socket code is doing something different than
>  standard C sockets, that is.
>
>  Have fun,
>
>  Avery
>  _______________________________________________
>  Mono-devel-list mailing list
>  Mono-devel-list at lists.ximian.com
>  http://lists.ximian.com/mailman/listinfo/mono-devel-list
>


More information about the Mono-devel-list mailing list