From: Miguel de Icaza Date: Wed, 23 Sep 2015 18:37:01 +0000 (-0400) Subject: Merge pull request #463 from strawd/concurrent-requests X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=559ad5b34bc086b51af2e589b32ea2eae0f78820 Merge pull request #463 from strawd/concurrent-requests Handle multiple concurrent calls to BeginTryReceiveRequest --- 559ad5b34bc086b51af2e589b32ea2eae0f78820 diff --cc mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs index d73b0866495,9a66a324500..4e47ecf0035 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs @@@ -126,36 -125,19 +127,36 @@@ namespace System.ServiceModel.Channel } try { return TryReceiveRequest (tout, out ctx); + } catch (XmlException ex) { + Console.WriteLine ("Xml Exception (Dropped Connection?):" + ex.Message); + //on dropped connection, + //whatever you do don't crash + //the whole app. Ignore for now + } catch (SocketException ex) { + Console.WriteLine ("Socket Exception (Dropped Connection?):" + ex.Message); + //on dropped connection, + //whatever you do don't crash + //the whole app. Ignore for now + } catch (IOException ex) { + Console.WriteLine ("I/O Exception (Dropped Connection?):" + ex.Message); + //on dropped connection, + //whatever you do don't crash + //the whole app. Ignore for now } finally { lock (async_result_lock) { - CurrentAsyncResult = null; - CurrentAsyncThread = null; + currentAsyncResults.Remove (result); + currentAsyncThreads.Remove (Thread.CurrentThread); } } + ctx = null; + return false; }); RequestContext dummy; - IAsyncResult result; lock (async_result_lock) { - result = CurrentAsyncResult = try_recv_delegate.BeginInvoke (timeout, out dummy, callback, state); + result = try_recv_delegate.BeginInvoke (timeout, out dummy, callback, state); + currentAsyncResults.Add (result); } - // Note that at this point CurrentAsyncResult can be null here if delegate has run to completion + // Note that at this point result can be missing from currentAsyncResults here if delegate has run to completion return result; }