public void Open()
        {
            // FUTURE: For security purpose, we need to set the right ACL to the Named-Pipe. Unfortunately
            // this is not supported in current WCF API.
            NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
            binding.MaxReceivedMessageSize = MaxControlReceivedMessageSize;
            binding.ReaderQuotas.MaxArrayLength = MaxControlReceivedMessageSize;
            channelFactory = new DuplexChannelFactory<IUdpControlRegistration>(
                new InstanceContext(null, this),
                binding,
                new EndpointAddress(HostedUdpConstants.ControlServiceAddress));

            IUdpControlRegistration controlRegistration = channelFactory.CreateChannel();
            controlChannel = controlRegistration as IDuplexSessionChannel;
            
            ControlRegistrationData data = new ControlRegistrationData();
            data.Uri = uri;
            data.InstanceId = instanceId;

            controlRegistration.Register(data);
        }
Пример #2
0
        void RegisterInternal(ControlRegistrationData data, UdpControlService serviceInstance)
        {
            if (this.State != CommunicationState.Opened)
            {
                return;
            }

            App app = appQueue.Lookup(data.Uri);
            if (app == null)
            {
                throw new InvalidOperationException("Application does not exist.");
            }

            if (app.Instance.Id != data.InstanceId)
            {
                throw new InvalidOperationException("Application does not have instance of such id.");
            }

            serviceInstance.SetApp(app);
            ThreadPool.QueueUserWorkItem(new WaitCallback(OnNewServiceInstanceAvailable), serviceInstance);
        }
Пример #3
0
 internal static void Dispatch(ControlRegistrationData data, UdpControlService serviceInstance)
 {
     singleton.RegisterInternal(data, serviceInstance);
 }
Пример #4
0
 public void Register(ControlRegistrationData data)
 {
     this.data = data;
     UdpListenerAdapter.Register(data, this);
     controlCallback = OperationContext.Current.GetCallbackChannel<IUdpControlCallback>();
 }