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:
authorAtsushi Eno <atsushi@ximian.com>2011-04-20 14:11:34 +0400
committerAtsushi Eno <atsushi@ximian.com>2011-04-20 14:11:34 +0400
commita316b856d044dfc68b2d48b4c4e0d2c666cee938 (patch)
treeeb2f2310945632a4cc4a772d492de66ab057f78d /mcs
parent987cef8a1cfe52927dccca1e1e0345c72c69c131 (diff)
Get real fix for bug #687902. Revert request processor IDisposable.
and handle session shutdown when creating InstanceContext. Also add note on DisposeInstance(), which got me stuck.
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs10
-rw-r--r--mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InitializingHandler.cs3
-rw-r--r--mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InputOrReplyRequestProcessor.cs14
-rw-r--r--mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/MessageProcessingContext.cs8
-rw-r--r--mcs/class/System.ServiceModel/System.ServiceModel/InstanceContext.cs3
-rw-r--r--mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs3
-rw-r--r--mcs/class/System.ServiceModel/Test/System.ServiceModel/IntegratedConnectionTest.cs4
7 files changed, 23 insertions, 22 deletions
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs
index 13e91bf31c9..2a84bcde8e3 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs
@@ -595,10 +595,7 @@ namespace System.ServiceModel.Dispatcher
try {
var req = rc.RequestMessage;
var ed = FindEndpointDispatcher (req);
- // FIXME: explicitly dispose this.
-// using (var processor = new InputOrReplyRequestProcessor (ed.DispatchRuntime, reply))
- var processor = new InputOrReplyRequestProcessor (ed.DispatchRuntime, reply);
- processor.ProcessReply (rc);
+ new InputOrReplyRequestProcessor (ed.DispatchRuntime, reply).ProcessReply (rc);
} catch (Exception ex) {
Message res;
if (ProcessErrorWithHandlers (reply, ex, out res))
@@ -643,10 +640,7 @@ namespace System.ServiceModel.Dispatcher
try {
EndpointDispatcher candidate = null;
candidate = FindEndpointDispatcher (message);
- // FIXME: explicitly dispose this.
-// using (var processor = new InputOrReplyRequestProcessor (candidate.DispatchRuntime, input))
- var processor = new InputOrReplyRequestProcessor (candidate.DispatchRuntime, input);
- processor.ProcessInput (message);
+ new InputOrReplyRequestProcessor (candidate.DispatchRuntime, input).ProcessInput (message);
}
catch (Exception ex) {
Message dummy;
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InitializingHandler.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InitializingHandler.cs
index ef501c9f53d..4ceff4fa280 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InitializingHandler.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InitializingHandler.cs
@@ -28,6 +28,9 @@ namespace System.ServiceModel.Dispatcher
if (iCtx == null) {
ServiceHostBase host = dispatchRuntime.ChannelDispatcher.Host;
iCtx = new InstanceContext (dispatchRuntime.ChannelDispatcher.Host, null, false);
+ // FIXME: could be easier way to identify session channel
+ if ((mrc.Channel is ISessionChannel<IInputSession> || mrc.Channel is ISessionChannel<IDuplexSession>) && host.Description.Behaviors.Find<ServiceBehaviorAttribute> ().InstanceContextMode == InstanceContextMode.PerSession)
+ mrc.Channel.Closed += delegate { iCtx.Close (); };
}
iCtx.InstanceManager = new InstanceManager (dispatchRuntime);
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InputOrReplyRequestProcessor.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InputOrReplyRequestProcessor.cs
index 36e7a15c6bc..9210e3b10db 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InputOrReplyRequestProcessor.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/InputOrReplyRequestProcessor.cs
@@ -9,7 +9,9 @@ using System.ServiceModel.MonoInternal;
namespace System.ServiceModel.Dispatcher
{
- internal class InputOrReplyRequestProcessor : BaseRequestProcessor, IDisposable
+ // Its lifetime is per-call.
+ // ServiceRuntimeChannel's lifetime is per-session.
+ internal class InputOrReplyRequestProcessor : BaseRequestProcessor
{
DispatchRuntime dispatch_runtime;
IChannel reply_or_input;
@@ -33,12 +35,6 @@ namespace System.ServiceModel.Dispatcher
FinalizationChain.AddHandler (new FinalizeProcessingHandler ());
}
- public void Dispose ()
- {
- if (context_channel != null)
- context_channel.Close ();
- }
-
void Init (DispatchRuntime runtime, IChannel replyOrInput)
{
dispatch_runtime = runtime;
@@ -48,14 +44,14 @@ namespace System.ServiceModel.Dispatcher
public void ProcessInput (Message message)
{
OperationContext opcx = CreateOperationContext (message);
- ProcessRequest (new MessageProcessingContext (opcx));
+ ProcessRequest (new MessageProcessingContext (opcx, reply_or_input));
}
public void ProcessReply (RequestContext rc)
{
OperationContext opcx = CreateOperationContext (rc.RequestMessage);
opcx.RequestContext = rc;
- ProcessRequest (new MessageProcessingContext (opcx));
+ ProcessRequest (new MessageProcessingContext (opcx, reply_or_input));
}
OperationContext CreateOperationContext (Message incoming)
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/MessageProcessingContext.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/MessageProcessingContext.cs
index 6abc3a25bbb..cb065c84155 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/MessageProcessingContext.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/MessageProcessingContext.cs
@@ -17,13 +17,19 @@ namespace System.ServiceModel.Dispatcher
Exception processingException;
DispatchOperation operation;
UserEventsHandler user_events_handler;
+ IChannel reply_or_input;
- public MessageProcessingContext (OperationContext opCtx)
+ public MessageProcessingContext (OperationContext opCtx, IChannel replyOrInput)
{
operation_context = opCtx;
request_context = opCtx.RequestContext;
incoming_message = opCtx.IncomingMessage;
user_events_handler = new UserEventsHandler (this);
+ reply_or_input = replyOrInput;
+ }
+
+ public IChannel Channel {
+ get { return reply_or_input; }
}
public DispatchOperation Operation
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/InstanceContext.cs b/mcs/class/System.ServiceModel/System.ServiceModel/InstanceContext.cs
index 336055261d9..ed999db7713 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/InstanceContext.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/InstanceContext.cs
@@ -158,7 +158,7 @@ namespace System.ServiceModel
public void ReleaseServiceInstance ()
{
instance_manager.ReleaseServiceInstance (this, implementation);
- // FIXME: should Dispose() be invoked here?
+ // This does NOT dispose the instance implementation. See DispatrchRuntimeTest.TestInstanceBehavior2 (which never reports "Dispose").
implementation = null;
}
@@ -167,6 +167,7 @@ namespace System.ServiceModel
var disp = implementation as IDisposable;
if (disp != null)
disp.Dispose ();
+ implementation = null;
}
protected override void OnAbort ()
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs
index b9288a74f18..745dab335c6 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs
@@ -116,6 +116,8 @@ namespace System.ServiceModel.MonoInternal
}
}
+ // Its lifetime is per-session.
+ // InputOrReplyRequestProcessor's lifetime is per-call.
#if DISABLE_REAL_PROXY
// FIXME: this is a (similar) workaround for bug 571907.
public
@@ -129,7 +131,6 @@ namespace System.ServiceModel.MonoInternal
public ServiceRuntimeChannel (IChannel channel, DispatchRuntime runtime)
{
this.channel = channel;
- channel.Closing += OnChannelClose;
this.runtime = runtime;
}
diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel/IntegratedConnectionTest.cs b/mcs/class/System.ServiceModel/Test/System.ServiceModel/IntegratedConnectionTest.cs
index 9369eafc919..1fc0a1ee8d1 100644
--- a/mcs/class/System.ServiceModel/Test/System.ServiceModel/IntegratedConnectionTest.cs
+++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel/IntegratedConnectionTest.cs
@@ -187,8 +187,8 @@ namespace MonoTests.System.ServiceModel
Assert.AreEqual (1, proxy.GetInstanceCounter (), "One server instance after second call in session #" + i);
factory.Close (); // should close session even when no IsTerminating method has been invoked
Thread.Sleep (500); // give WCF time to dispose service object
- Assert.AreEqual (0, Foo3.InstanceCounter, "Service instances must be disposed after channel is closed");
- Assert.AreEqual (i, Foo3.CreatedInstances, "One new instance per session");
+ Assert.AreEqual (0, Foo3.InstanceCounter, "Service instances must be disposed after channel is closed, in session #" + i);
+ Assert.AreEqual (i, Foo3.CreatedInstances, "One new instance per session, in session #" + i);
}
host.Close ();
}