mono/mono — pull request #359 by robwilkens (2012-06-28 21:30:46+00:00)
Title: Attempt to fix two crash conditions with possible SocketException Mishan...

...dling

The fix in ReplyChannelBase.cs catches a SocketException and ignores it.
There was a stacktrace where a SocketException indicating the remote end
disconnected before we were done with it, and this caused a crash. While
we shouldn't stop all exceptions here, at this point it should be safe to
ignore a dropped connection.

The fix in ChannelDispatcher.cs is based on a similar problem. Remote end
has possibly disconnected before we were done with it. That raised an
exception, and in this code (which is a generic exception handler) we try
to send a reply back over that connection indicating that we had an exception
but in the case of the crash (stacktrace) this causes a problem because the
first thing the reply tries to do is set the content type, and since we had
already started sending a transmission before they disconnected (Raising, in
theory, the socket error) we could not resend the content type because the
headers were sent already.

Note: While i could not and cannot (without a lot of homework) come up with
a reliable unit test to recreate these problems, none of the existing
System.ServiceModel unit tests are failing with these changes in place.

These are all based on guesses based on looking at stack traces on the
mailing list recently. They seem logical to me, but i cannot test these
changes because i cannot reproduce them.