private OperationContext SetupOperationConext(IRpcCallInfo call, MessageRequest request, Type contractType) { var operationContext = new OperationContext { SessionId = request.Session }; if (request.Session != null) { if (_duplex) { lock (_clients) { RpcCallbackChannelFactory channelFactory = null; bool contains = _clients.TryGetValue(request.Session, out channelFactory); if (!contains) { var contract = AttributesReader.GetServiceContract(contractType); channelFactory = new RpcCallbackChannelFactory(_endpoint._binding, contract.CallbackContract, new Guid(request.Session), true); _clients[request.Session] = channelFactory; } var callbackBindingInfo = EndpointMapper.WcfToRpc(_endpoint._address); if (!call.IsClientLocal) { //BUG: callbacks accross network does not work //callbackAddress.NetworkAddr = call.ClientAddress } callbackBindingInfo.EndPoint += request.Session.Replace("-", ""); operationContext.SetGetter(_clients[request.Session], EndpointMapper.RpcToWcf(callbackBindingInfo)); } } } return(operationContext); }
internal void SetGetter(RpcCallbackChannelFactory rpcChannelFactory, string address) { _getter = rpcChannelFactory; _address = address; }