[Mono-dev] fix for bug #358987 in 1.9?
Steve Bjorg
steveb at mindtouch.com
Thu Feb 21 11:11:15 EST 2008
Two thumbs up! Thanks.
- Steve
--------------
Steve G. Bjorg
http://wiki.mindtouch.com
http://wiki.opengarden.org
On Feb 21, 2008, at 3:53 AM, Zoltan Varga wrote:
> 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