You've already forked linux-packaging-mono
Imported Upstream version 3.12.0
Former-commit-id: cf92446697332992ec36726e78eb8703e1f259d7
This commit is contained in:
@ -389,7 +389,7 @@ namespace System.ServiceModel
|
||||
var od = cd.Operations.Find (methodName);
|
||||
if (od == null)
|
||||
throw new ArgumentException (String.Format ("Operation '{0}' not found in the service contract '{1}' in namespace '{2}'", methodName, cd.Name, cd.Namespace));
|
||||
return Inner.Process (od.SyncMethod, methodName, args);
|
||||
return Inner.Process (od.SyncMethod, methodName, args, OperationContext.Current);
|
||||
}
|
||||
|
||||
protected IAsyncResult BeginInvoke (string methodName, object [] args, AsyncCallback callback, object state)
|
||||
|
@ -108,8 +108,7 @@ namespace System.ServiceModel
|
||||
// sync invocation
|
||||
pl = new object [inmsg.MethodBase.GetParameters ().Length];
|
||||
Array.Copy (inmsg.Args, pl, inmsg.ArgCount);
|
||||
channel.Context = OperationContext.Current;
|
||||
ret = channel.Process (inmsg.MethodBase, od.Name, pl);
|
||||
ret = channel.Process (inmsg.MethodBase, od.Name, pl, OperationContext.Current);
|
||||
method = od.SyncMethod;
|
||||
} else if (inmsg.MethodBase.Equals (od.BeginMethod)) {
|
||||
// async invocation
|
||||
|
@ -46,9 +46,7 @@ namespace System.ServiceModel.MonoInternal
|
||||
{
|
||||
ContractDescription Contract { get; }
|
||||
|
||||
OperationContext Context { set; }
|
||||
|
||||
object Process (MethodBase method, string operationName, object [] parameters);
|
||||
object Process (MethodBase method, string operationName, object [] parameters, OperationContext context);
|
||||
|
||||
IAsyncResult BeginProcess (MethodBase method, string operationName, object [] parameters, AsyncCallback callback, object asyncState);
|
||||
|
||||
@ -69,12 +67,11 @@ namespace System.ServiceModel.MonoInternal
|
||||
TimeSpan default_open_timeout, default_close_timeout;
|
||||
IChannel channel;
|
||||
IChannelFactory factory;
|
||||
OperationContext context;
|
||||
|
||||
#region delegates
|
||||
readonly ProcessDelegate _processDelegate;
|
||||
|
||||
delegate object ProcessDelegate (MethodBase method, string operationName, object [] parameters);
|
||||
delegate object ProcessDelegate (MethodBase method, string operationName, bool isAsync, ref object [] parameters, OperationContext context);
|
||||
|
||||
readonly RequestDelegate requestDelegate;
|
||||
|
||||
@ -149,10 +146,6 @@ namespace System.ServiceModel.MonoInternal
|
||||
get { return channel as IDuplexChannel; }
|
||||
}
|
||||
|
||||
public OperationContext Context {
|
||||
set { context = value; }
|
||||
}
|
||||
|
||||
#region IClientChannel
|
||||
|
||||
bool did_interactive_initialization;
|
||||
@ -445,42 +438,48 @@ namespace System.ServiceModel.MonoInternal
|
||||
|
||||
public IAsyncResult BeginProcess (MethodBase method, string operationName, object [] parameters, AsyncCallback callback, object asyncState)
|
||||
{
|
||||
if (context != null)
|
||||
throw new InvalidOperationException ("another operation is in progress");
|
||||
context = OperationContext.Current;
|
||||
|
||||
try {
|
||||
return _processDelegate.BeginInvoke (method, operationName, parameters, callback, asyncState);
|
||||
} catch {
|
||||
context = null;
|
||||
throw;
|
||||
}
|
||||
var p = parameters;
|
||||
var retval = _processDelegate.BeginInvoke (method, operationName, true, ref p, OperationContext.Current, callback, asyncState);
|
||||
if (p != parameters)
|
||||
throw new InvalidOperationException ();
|
||||
return retval;
|
||||
}
|
||||
|
||||
public object EndProcess (MethodBase method, string operationName, object [] parameters, IAsyncResult result)
|
||||
{
|
||||
try {
|
||||
if (result == null)
|
||||
throw new ArgumentNullException ("result");
|
||||
if (parameters == null)
|
||||
throw new ArgumentNullException ("parameters");
|
||||
// FIXME: the method arguments should be verified to be
|
||||
// identical to the arguments in the corresponding begin method.
|
||||
return _processDelegate.EndInvoke (result);
|
||||
} finally {
|
||||
context = null;
|
||||
}
|
||||
if (result == null)
|
||||
throw new ArgumentNullException ("result");
|
||||
if (parameters == null)
|
||||
throw new ArgumentNullException ("parameters");
|
||||
|
||||
object[] p = parameters;
|
||||
var retval = _processDelegate.EndInvoke (ref p, result);
|
||||
if (p == parameters)
|
||||
return retval;
|
||||
|
||||
if (p.Length != parameters.Length)
|
||||
throw new InvalidOperationException ();
|
||||
Array.Copy (p, parameters, p.Length);
|
||||
return retval;
|
||||
}
|
||||
|
||||
public object Process (MethodBase method, string operationName, object [] parameters)
|
||||
public object Process (MethodBase method, string operationName, object [] parameters, OperationContext context)
|
||||
{
|
||||
var p = parameters;
|
||||
var retval = Process (method, operationName, false, ref p, context);
|
||||
if (p != parameters)
|
||||
throw new InvalidOperationException ();
|
||||
return retval;
|
||||
}
|
||||
|
||||
object Process (MethodBase method, string operationName, bool isAsync, ref object [] parameters, OperationContext context)
|
||||
{
|
||||
var previousContext = OperationContext.Current;
|
||||
try {
|
||||
// Inherit the context from the calling thread
|
||||
if (this.context != null)
|
||||
OperationContext.Current = this.context;
|
||||
OperationContext.Current = context;
|
||||
|
||||
return DoProcess (method, operationName, parameters);
|
||||
return DoProcess (method, operationName, isAsync, ref parameters, context);
|
||||
} catch (Exception ex) {
|
||||
throw;
|
||||
} finally {
|
||||
@ -489,7 +488,7 @@ namespace System.ServiceModel.MonoInternal
|
||||
}
|
||||
}
|
||||
|
||||
object DoProcess (MethodBase method, string operationName, object [] parameters)
|
||||
object DoProcess (MethodBase method, string operationName, bool isAsync, ref object [] parameters, OperationContext context)
|
||||
{
|
||||
if (AllowInitializationUI)
|
||||
DisplayInitializationUI ();
|
||||
@ -499,9 +498,9 @@ namespace System.ServiceModel.MonoInternal
|
||||
Open ();
|
||||
|
||||
if (!od.IsOneWay)
|
||||
return Request (od, parameters);
|
||||
return Request (od, isAsync, ref parameters, context);
|
||||
else {
|
||||
Output (od, parameters);
|
||||
Output (od, parameters, context);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -519,17 +518,17 @@ namespace System.ServiceModel.MonoInternal
|
||||
return od;
|
||||
}
|
||||
|
||||
void Output (OperationDescription od, object [] parameters)
|
||||
void Output (OperationDescription od, object [] parameters, OperationContext context)
|
||||
{
|
||||
ClientOperation op = runtime.Operations [od.Name];
|
||||
Send (CreateRequest (op, parameters), OperationTimeout);
|
||||
Send (CreateRequest (op, parameters, context), OperationTimeout);
|
||||
}
|
||||
|
||||
object Request (OperationDescription od, object [] parameters)
|
||||
object Request (OperationDescription od, bool isAsync, ref object [] parameters, OperationContext context)
|
||||
{
|
||||
ClientOperation op = runtime.Operations [od.Name];
|
||||
object [] inspections = new object [runtime.MessageInspectors.Count];
|
||||
Message req = CreateRequest (op, parameters);
|
||||
Message req = CreateRequest (op, parameters, context);
|
||||
|
||||
for (int i = 0; i < inspections.Length; i++)
|
||||
inspections [i] = runtime.MessageInspectors [i].BeforeSendRequest (ref req, this);
|
||||
@ -566,10 +565,15 @@ namespace System.ServiceModel.MonoInternal
|
||||
for (int i = 0; i < inspections.Length; i++)
|
||||
runtime.MessageInspectors [i].AfterReceiveReply (ref res, inspections [i]);
|
||||
|
||||
if (op.DeserializeReply)
|
||||
return op.Formatter.DeserializeReply (res, parameters);
|
||||
else
|
||||
if (!op.DeserializeReply)
|
||||
return res;
|
||||
|
||||
if (isAsync && od.EndMethod != null) {
|
||||
var endParams = od.EndMethod.GetParameters ();
|
||||
parameters = new object [endParams.Length - 1];
|
||||
}
|
||||
|
||||
return op.Formatter.DeserializeReply (res, parameters);
|
||||
}
|
||||
|
||||
#region Message-based Request() and Send()
|
||||
@ -621,7 +625,7 @@ namespace System.ServiceModel.MonoInternal
|
||||
}
|
||||
#endregion
|
||||
|
||||
Message CreateRequest (ClientOperation op, object [] parameters)
|
||||
Message CreateRequest (ClientOperation op, object [] parameters, OperationContext context)
|
||||
{
|
||||
MessageVersion version = message_version;
|
||||
if (version == null)
|
||||
|
@ -114,9 +114,9 @@ namespace System.ServiceModel.MonoInternal
|
||||
return client.EndProcess (method, operationName, parameters, result);
|
||||
}
|
||||
|
||||
public object Process (MethodBase method, string operationName, object [] parameters)
|
||||
public object Process (MethodBase method, string operationName, object [] parameters, OperationContext context)
|
||||
{
|
||||
return client.Process (method, operationName, parameters);
|
||||
return client.Process (method, operationName, parameters, context);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user