Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorJoão Matos <joao@tritao.eu>2015-12-21 20:44:41 +0300
committerJoão Matos <joao@tritao.eu>2015-12-21 20:44:41 +0300
commit6f4db43170d20245dde37078b8d0dd39fbba541f (patch)
treee26160052282af3f50bf0cd97047e88405810738 /mcs
parentca587aad35b859e7e161e4ceea98311b303bfcab (diff)
parent672cc6819815b0206d3f685c7379e00de916cd4d (diff)
Merge pull request #2373 from akoeplinger/servicemodel-tcpreplychannel-race
[ServiceModel] Make TcpReplyChannel.OnClose thread-safe
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs9
-rw-r--r--mcs/class/System.ServiceModel/System.ServiceModel.Channels.NetTcp/TcpReplyChannel.cs9
2 files changed, 15 insertions, 3 deletions
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs
index 03e7cad1f1c..098b622aa83 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs
@@ -104,12 +104,15 @@ namespace System.ServiceModel.Channels.Http
}
bool close_started;
+ object close_lock = new object ();
protected override void OnClose (TimeSpan timeout)
{
- if (close_started)
- return;
- close_started = true;
+ lock (close_lock) {
+ if (close_started)
+ return;
+ close_started = true;
+ }
DateTime start = DateTime.Now;
// FIXME: consider timeout
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels.NetTcp/TcpReplyChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels.NetTcp/TcpReplyChannel.cs
index f597167e9d1..b005ad6c18a 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels.NetTcp/TcpReplyChannel.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels.NetTcp/TcpReplyChannel.cs
@@ -135,9 +135,18 @@ namespace System.ServiceModel.Channels.NetTcp
{
throw new NotImplementedException ();
}
+
+ bool close_started;
+ object close_lock = new object ();
protected override void OnClose (TimeSpan timeout)
{
+ lock (close_lock) {
+ if (close_started)
+ return;
+ close_started = true;
+ }
+
client.Close ();
client = null;
base.OnClose (timeout);