Exemple #1
0
        /// <summary>
        /// The message loop to process fluent requests from REST endpoint.
        /// </summary>
        /// <param name="cancellationToken">task cancellation token</param>
        /// <returns></returns>
        private async Task RunAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            Console.WriteLine("\nStarting Message loop...!\n");

            var channel = await RequestChannel.CreateAsync(cancellationToken);

            while (!cancellationToken.IsCancellationRequested)
            {
                var nextRequest = await channel.TryReadNextAsync(cancellationToken);

                if (nextRequest != null)
                {
                    Console.WriteLine($"Received request: {nextRequest.RequestId}");
                    //
                    // Don't call await here. Since this call is happening in the message loop
                    // the parent method will not be returned. By not calling await, we can
                    // prcoess requests concurrenlty. With await the requests will be processed
                    // async-serially.
                    //
                    HandleRequestAsync(nextRequest.RequestId, nextRequest.RequestModel, cancellationToken);
                }
                await Task.Delay(TimeSpan.FromSeconds(3), cancellationToken);
            }

            Console.WriteLine("\nMessage loop Stopped...!\n");
        }
Exemple #2
0
        public Task <string> SendAsync(int request)
        {
            var tcs  = new TaskCompletionSource <string>();
            var item = new CorrelationItem <int>(request);

            _map.TryAdd(item.Correlation, tcs);
            RequestChannel.TryAdd(item);
            return(tcs.Task);
        }
Exemple #3
0
 private void WatchLoop()
 {
     foreach (var r in RequestChannel.GetConsumingEnumerable())
     {
         var request = r;                    // capture variable
         Thread.Sleep(request.Value * 1000); // BAD PRACTICE (should be await Task.Delay)
         var item = new CorrelationItem <string>(request.Correlation, $"Data of {request.Value}");
         ResponseChannel.TryAdd(item);
     }
 }
Exemple #4
0
		public IUniversalRequestObject Convert(RequestChannel requestChannel)
		{
			UniversalRequestObject uro = new UniversalRequestObject();

			uro.OriginalContentBytes = GetMime();

			Convert(requestChannel, uro);

			return uro;
		}
 // They are internal for ClientBase<T>.ChannelBase use.
 internal Message Request(Message msg, TimeSpan timeout)
 {
     if (RequestChannel != null)
     {
         return(RequestChannel.Request(msg, timeout));
     }
     else
     {
         return(RequestCorrelated(msg, timeout, OutputChannel));
     }
 }
 internal void Send(Message msg, TimeSpan timeout)
 {
     if (OutputChannel != null)
     {
         OutputChannel.Send(msg, timeout);
     }
     else
     {
         RequestChannel.Request(msg, timeout);                  // and ignore returned message.
     }
 }
Exemple #7
0
 internal void Send(Message msg, TimeSpan timeout)
 {
     if (OutputChannel != null)
     {
         OutputChannel.Send(msg, timeout);
     }
     else
     {
         RequestChannel.Request(msg, timeout);
     }
 }
Exemple #8
0
        public static void TestReqReply1(IFiber fiber)
        {
            var channel = new RequestChannel <string, string>();

            using (fiber)
                using (channel.SetRequestHandler(fiber, req => req.Reply("bye")))
                {
                    string reply = channel.SendRequest("hello").Receive(TimeSpan.FromSeconds(1)).Value;
                    Assert.AreEqual("bye", reply);
                }
        }
Exemple #9
0
        public static async Task TestReqReplyAsync(IFiber fiber)
        {
            RequestChannel <string, string> channel = new RequestChannel <string, string>();

            using (fiber)
                using (channel.SetRequestHandler(fiber, req => req.Reply("bye")))
                {
                    string reply = await channel.SendRequestAsync("hello");

                    Assert.AreEqual("bye", reply);
                }
        }
Exemple #10
0
 // They are internal for ClientBase<T>.ChannelBase use.
 internal Message Request(Message msg, TimeSpan timeout)
 {
     if (RequestChannel != null)
     {
         return(RequestChannel.Request(msg, timeout));
     }
     else
     {
         DateTime startTime = DateTime.Now;
         OutputChannel.Send(msg, timeout);
         return(((IDuplexChannel)OutputChannel).Receive(timeout - (DateTime.Now - startTime)));
     }
 }
Exemple #11
0
        public void TestName()
        {
            IRequestChannel <int, int> channel = new RequestChannel <int, int>();
            IFiber fiber1 = PoolFiber.StartNew();

            channel.SetRequestHandler(fiber1, request => request.Reply(request.Request + 1));
            using (var perfTimer = new PerfTimer(1000000))
            {
                for (int i = 0; i < 1000000; i++)
                {
                    channel.SendRequest(0);
                }
            }
        }
Exemple #12
0
 private void WatchLoopAsync()
 {
     foreach (var r in RequestChannel.GetConsumingEnumerable())
     {
         var request = r; // capture variable
         var t       = Task.Run(async() =>
         {
             await Task.Delay(request.Value * 1000).ConfigureAwait(false);
             var item = new CorrelationItem <string>(request.Correlation, $"Data of {request.Value}");
             ResponseChannel.TryAdd(item);
         });
         t.Start();
     }
 }
Exemple #13
0
 private void WatchLoop()
 {
     foreach (var r in RequestChannel.GetConsumingEnumerable())
     {
         var request = r; // capture variable
         var t       = new Thread(() =>
         {
             Thread.Sleep(request.Value * 1000); // BAD PRACTICE
             var item = new CorrelationItem <string>(request.Correlation, $"Data of {request.Value}");
             ResponseChannel.TryAdd(item);
         });
         t.Start();
     }
 }
Exemple #14
0
        public async Task BasicRequestReplyAsync()
        {
            IRequestChannel <int, int> channel = new RequestChannel <int, int>();
            Fiber fiber1 = new Fiber();

            channel.SetRequestHandler(fiber1, request => request.Reply(request.Request + 1));
            using (PerfTimer perfTimer = new PerfTimer(1000000))
            {
                for (int i = 0; i < 1000000; i++)
                {
                    int reply = await channel.SendRequestAsync(0);

                    // Assert.AreEqual(1, reply);
                }
            }
        }
Exemple #15
0
        internal Request(IChannelOwner parent, string guid, RequestInitializer initializer) : base(parent, guid)
        {
            // TODO: Consider using a mapper between RequestInitiliazer and this object
            _channel       = new(guid, parent.Connection, this);
            _initializer   = initializer;
            RedirectedFrom = _initializer.RedirectedFrom;
            PostDataBuffer = _initializer.PostData;
            Timing         = new();

            if (RedirectedFrom != null)
            {
                _initializer.RedirectedFrom.RedirectedTo = this;
            }

            _headers = new RawHeaders(initializer.Headers.ConvertAll(x => new NameValueEntry(x.Name, x.Value)).ToArray());
        }
Exemple #16
0
        public async Task <IActionResult> Post([FromBody] FluentRequestModel fluentRequestPayload)
        {
            if (fluentRequestPayload == null)
            {
                return(BadRequest(new Exception("Failed to parse the json payload, make sure it is valid")));
            }

            var channel = await RequestChannel.CreateAsync();

            var requestId = await channel.WriteAsync(fluentRequestPayload);

            var pollingUrl = Link($"GetCreateStatus/{requestId}");

            HttpContext.Response.Headers["Location"] = pollingUrl;

            return(Ok(new BeginCreateResponse(pollingUrl)));
        }
Exemple #17
0
        static void Main(string[] args)
        {
            _server = new Server();

            //TODO: remove the Dequeue loop
            Thread t = new Thread(DequeueLoop);

            t.Start();

            int[] requets = { 1, 5, 1, 3 };
            foreach (var r in requets)
            {
                var item = new CorrelationItem <int>(r);
                Console.WriteLine($"Sending: {item.Value} [{item.Correlation:N}]");
                RequestChannel.Add(item);
                // TODO: replace _requestChannel.Add(item); with wrapper that return Task<string>
            }

            Console.ReadKey();
        }
Exemple #18
0
        internal Request(IChannelOwner parent, string guid, RequestInitializer initializer) : base(parent, guid)
        {
            _channel       = new RequestChannel(guid, parent.Connection, this);
            _initializer   = initializer;
            RedirectedFrom = _initializer.RedirectedFrom?.Object;
            PostDataBuffer = _initializer.PostData != null?Convert.FromBase64String(_initializer.PostData) : null;

            if (RedirectedFrom != null)
            {
                _initializer.RedirectedFrom.Object.RedirectedTo = this;
            }

            if (initializer.Headers != null)
            {
                foreach (var kv in initializer.Headers)
                {
                    Headers[kv.Name] = kv.Value;
                }
            }
        }
        public Message Request(Message message, TimeSpan timeout)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }
            WcfClientEventSource.Log.ChannelCalled(GetType().FullName, nameof(Request));
            var telemetry = StartSendTelemetry(message, nameof(Request));

            try
            {
                var response = RequestChannel.Request(message, timeout);
                StopSendTelemetry(telemetry, response, null, nameof(Request));
                return(response);
            } catch (Exception ex)
            {
                StopSendTelemetry(telemetry, null, ex, nameof(Request));
                throw;
            }
        }
Exemple #20
0
        /// <summary>
        /// Constructs a <see cref="WSTrustChannel" />.
        /// </summary>
        /// <param name="requestChannel">The <see cref="IRequestChannel" /> this channel will be used to send a <see cref="WsTrustRequest" /> to the STS.</param>
        public WSTrustChannel(IRequestChannel requestChannel)
        {
            RequestChannel = requestChannel ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(requestChannel));
            if (requestChannel.State != CommunicationState.Created)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(LogHelper.FormatInvariant(SR.GetResourceString(SR.IRequestChannelMustBeCreated), requestChannel.State)));
            }

            MessageVersion = RequestChannel.GetProperty <MessageVersion>();
            if (MessageVersion == null || MessageVersion == MessageVersion.None)
            {
                MessageVersion = MessageVersion.Default;
            }

            EndpointAddress endpointAddress = RequestChannel.GetProperty <EndpointAddress>();

            if (endpointAddress != null)
            {
                Address = endpointAddress.Uri?.AbsoluteUri;
            }
        }
Exemple #21
0
        internal Request(IChannelOwner parent, string guid, RequestInitializer initializer) : base(parent, guid)
        {
            // TODO: Consider using a mapper between RequestInitiliazer and this object
            _channel       = new RequestChannel(guid, parent.Connection, this);
            _initializer   = initializer;
            RedirectedFrom = _initializer.RedirectedFrom?.Object;
            PostDataBuffer = _initializer.PostData != null?Convert.FromBase64String(_initializer.PostData) : null;

            Timing = new RequestTimingResult();

            if (RedirectedFrom != null)
            {
                _initializer.RedirectedFrom.Object.RedirectedTo = this;
            }

            if (initializer.Headers != null)
            {
                Headers = initializer.Headers.Select(x => new KeyValuePair <string, string>(x.Name, x.Value)).ToArray();
            }
            else
            {
                Headers = Array.Empty <KeyValuePair <string, string> >();
            }
        }
Exemple #22
0
		public void Convert(RequestChannel requestChannel, IUniversalRequestObject uro)
		{
			uro.PolicyType = PolicyType.ClientEmail;
			uro.DataTimeStamp = DateTime.Now;

			//These properties must all be set or else this email will be misinterpreted as the incorrect FileType.
			uro.Properties[MailMessagePropertyKeys.FileHeader] = String.Empty;
			uro.Properties[MailMessagePropertyKeys.Body] = m_emailProxy.BodyText;
			uro.Properties[MailMessagePropertyKeys.FormattedBody] = m_emailProxy.FormattedBodyText;
			uro.Properties[MailMessagePropertyKeys.Subject] = m_emailProxy.Subject;
			uro.Properties[SMTPPropertyKeys.RequestChannel] = requestChannel.ToString();
			uro.Destination.Properties[SMTPPropertyKeys.RequestChannel] = requestChannel.ToString();
			uro.Source.Properties[SMTPPropertyKeys.RequestChannel] = requestChannel.ToString();

			uro.Source.Items.Clear();

			uro.Source.PolicyType = uro.PolicyType;
			uro.Destination.PolicyType = uro.PolicyType;

			ProcessSender(uro);
			ProcessToRecipients(uro);
			ProcessCcRecipients(uro);
			ProcessBccRecipients(uro);
			ProcessAttachments(uro);

			ProcessHeaders(uro);

			if (m_emailProxy.MimeSize < 3000000)	// only for less than 3 Megabytes! (arbitrarily chosen figure)
			{
				uro.Properties[MailMessagePropertyKeys.MimeContent] = m_emailProxy.MimeContent;
			}
			else
			{
				uro.Properties[MailMessagePropertyKeys.LargeMimeContent] = "True";	// as was too large
			}
		}
Exemple #23
0
 /// <summary>
 /// Begins an asynchronous operation to open a communication object.
 /// </summary>
 /// <param name="callback">
 /// The <see cref="AsyncCallback" /> delegate that receives notification of the completion of the asynchronous
 /// close operation.
 /// </param>
 /// <param name="state">
 /// An object, specified by the application, that contains state information associated with the asynchronous
 /// close operation.
 /// </param>
 /// <returns>The <see cref="IAsyncResult" /> that references the asynchronous open operation.</returns>
 IAsyncResult ICommunicationObject.BeginOpen(AsyncCallback callback, object state)
 {
     return(RequestChannel.BeginOpen(callback, state));
 }
 public void Fault(RequestChannel requestChannel)
 {
     this.Cleanup();
 }
 public void Abort(RequestChannel requestChannel)
 {
     this.Cleanup();
 }
Exemple #26
0
 public static void TestReqReply1(IFiber fiber)
 {
     var channel = new RequestChannel<string, string>();
     using (fiber)
     using (channel.SetRequestHandler(fiber, req => req.Reply("bye")))
     {
         string reply = channel.SendRequest("hello").Receive(TimeSpan.FromSeconds(1)).Value;
         Assert.AreEqual("bye", reply);
     }
 }
Exemple #27
0
 public void TestName()
 {
     IRequestChannel<int, int> channel = new RequestChannel<int, int>();
     IFiber fiber1 = PoolFiber.StartNew();
 }
 internal Request(ConnectionScope scope, string guid, RequestInitializer initializer)
 {
     _scope   = scope;
     _channel = new RequestChannel(guid, scope, this);
 }
Exemple #29
0
        //static partial void Operation(string message, long BufferLength = -1);
        //static partial void StateEnter(States state);
        //static partial void Decode(string message, States? newstate = null, long BufferLength = -1, string name = null);
        //static partial void Decoded(string message);

        //static partial void OnSetup(IRSocketProtocol sink, in RSocketProtocol.Setup message);
        //static partial void OnError(IRSocketProtocol sink, in RSocketProtocol.Error message);
        //static partial void OnPayload(IRSocketProtocol sink, in RSocketProtocol.Payload message, ReadOnlySequence<byte> metadata, ReadOnlySequence<byte> data);
        //static partial void OnRequestStream(IRSocketProtocol sink, in RSocketProtocol.RequestStream message);

        //static public int MessageFrame(int length, bool isEndOfMessage) => isEndOfMessage ? length | (0b1 << sizeof(int) * 8 - 1) : length;	//High bit is EoM mark. Can't use twos-complement because negative zero is a legal value.
        //static public (int length, bool isEndofMessage) MessageFrame(int frame) => ((frame & ~(0b1 << sizeof(int) * 8 - 1)), (frame & (0b1 << sizeof(int) * 8 - 1)) != 0);

        static public async Task Handler2(IRSocketProtocol sink, PipeReader pipereader, CancellationToken cancellation, string name = null)
        {
            //The original implementation was a state-machine parser with resumability. It doesn't seem like the other implementations follow this pattern and the .NET folks are still figuring this out too - see the internal JSON parser discussion for how they're handling state machine persistence across async boundaries when servicing a Pipeline. So, this version of the handler only processes complete messages at some cost to memory buffer scalability.
            //Note that this means that the Pipeline must be configured to have enough buffering for a complete message before source-quenching. This also means that the downstream consumers don't really have to support resumption, so the interface no longer has the partial buffer methods in it.

            while (!cancellation.IsCancellationRequested)
            {
                var read = await pipereader.ReadAsync(cancellation);

                var buffer = read.Buffer;
                if (buffer.IsEmpty && read.IsCompleted)
                {
                    break;
                }
                var position = buffer.Start;

                //Due to the nature of Pipelines as simple binary pipes, all Transport adapters assemble a standard message frame whether or not the underlying transport signals length, EoM, etc.
                if (!TryReadInt32BigEndian(buffer, ref position, out int frame))
                {
                    pipereader.AdvanceTo(buffer.Start, buffer.End); continue;
                }
                var(framelength, ismessageend) = MessageFrame(frame);
                if (buffer.Length < framelength)
                {
                    pipereader.AdvanceTo(buffer.Start, buffer.End); continue;
                }                                                                                                               //Don't have a complete message yet. Tell the pipe that we've evaluated up to the current buffer end, but cannot yet consume it.

                Process(framelength, buffer.Slice(position));
                pipereader.AdvanceTo(buffer.GetPosition(framelength, position));
                //TODO - this should work now too!!! Need to evaluate if there is more than one packet in the pipe including edges like part of the length bytes are there but not all.
            }
            pipereader.Complete();


            void Process(int framelength, ReadOnlySequence <byte> sequence)
            {
                var reader = new SequenceReader <byte>(sequence);
                var header = new Header(ref reader, framelength);

                switch (header.Type)
                {
                case Types.Reserved: { throw new InvalidOperationException($"Protocol Reserved! [{header.Type}]"); }

                case Types.Setup:
                    var setup = new Setup(header, ref reader);
                    OnSetup(sink, setup);
                    break;

                case Types.Lease:
                    var lease = new Lease(header, ref reader);
                    break;

                case Types.KeepAlive:
                    var keepalive = new KeepAlive(header, ref reader);
                    break;

                case Types.Request_Response:
                    var requestresponse = new RequestResponse(header, ref reader);
                    if (requestresponse.Validate())
                    {
                        OnRequestResponse(sink, requestresponse, requestresponse.ReadMetadata(ref reader), requestresponse.ReadData(ref reader));
                    }
                    break;

                case Types.Request_Fire_And_Forget:
                    var requestfireandforget = new RequestFireAndForget(header, ref reader);
                    if (requestfireandforget.Validate())
                    {
                        OnRequestFireAndForget(sink, requestfireandforget, requestfireandforget.ReadMetadata(ref reader), requestfireandforget.ReadData(ref reader));
                    }
                    break;

                case Types.Request_Stream:
                    var requeststream = new RequestStream(header, ref reader);
                    if (requeststream.Validate())
                    {
                        OnRequestStream(sink, requeststream, requeststream.ReadMetadata(ref reader), requeststream.ReadData(ref reader));
                    }
                    break;

                case Types.Request_Channel:
                    var requestchannel = new RequestChannel(header, ref reader);
                    if (requestchannel.Validate())
                    {
                        OnRequestChannel(sink, requestchannel, requestchannel.ReadMetadata(ref reader), requestchannel.ReadData(ref reader));
                    }
                    break;

                case Types.Request_N:
                    var requestne = new RequestN(header, ref reader);
                    break;

                case Types.Cancel:
                    var cancel = new Cancel(header, ref reader);
                    break;

                case Types.Payload:
                    var payload = new Payload(header, ref reader);
                    Decoded(payload.ToString());
                    if (payload.Validate())
                    {
                        OnPayload(sink, payload, payload.ReadMetadata(ref reader), payload.ReadData(ref reader));
                        //reader.Sequence.Slice(reader.Position, payload.MetadataLength), reader.Sequence.Slice(reader.Sequence.GetPosition(payload.MetadataLength, reader.Position), payload.DataLength));
                    }
                    break;

                case Types.Error:
                    var error = new Error(header, ref reader);
                    Decoded(error.ToString());
                    OnError(sink, error);
                    break;

                case Types.Metadata_Push:
                    var metadatapush = new MetadataPush(header, ref reader);
                    break;

                case Types.Resume: { throw new NotSupportedException($"Protocol Resumption not Supported. [{header.Type}]"); }

                case Types.Resume_OK: { throw new NotSupportedException($"Protocol Resumption not Supported. [{header.Type}]"); }

                case Types.Extension: if (!header.CanIgnore)
                    {
                        throw new InvalidOperationException($"Protocol Extension Unsupported! [{header.Type}]");
                    }
                    else
                    {
                        break;
                    }

                default: if (!header.CanIgnore)
                    {
                        throw new InvalidOperationException($"Protocol Unknown Type! [{header.Type}]");
                    }
                    else
                    {
                        break;
                    }
                }

                //while (!buffer.IsEmpty)
                //	{
                //		var position = buffer.Start;


                //		Int32 length;
                //		bool isEndOfMessage;
                //		Int32 stream = 0;
                //		Types type = 0;
                //		ushort flags = 0;

                //		//var header = new Header();

                //		//TODO Protocol assertions (0 bit in stream, etc)

                //		while (!buffer.IsEmpty)
                //		{
                //			StateEnter(state);
                //			switch (state)
                //			{
                //				case States.Remaining:  //Transition to this state to just dump everything the remaining for inspection.
                //					if (TryReadByte(buffer, ref position, out var remaining)) { Decode($" [{remaining:X2}] '{Encoding.ASCII.GetString(new[] { remaining })}'", BufferLength: buffer.Length, name: name); break; }
                //					else { goto Break; } //Break a loop from within a switch. This is the recommended way to do this in C# if you don't want to allocate a looping flag.
                //				case States.Length: if (TryReadInt32BigEndian(buffer, ref position, out var frame)) { (length, isEndOfMessage) = MessageFrame(frame); state = States.Stream; Decode($" [{length}, {isEndOfMessage:5}]", state, buffer.Length, name: name); break; } else { goto Break; }
                //				case States.Stream: if (TryReadInt32BigEndian(buffer, ref position, out stream)) { state = States.Flags; Decode($" [0x{stream:X8}]", state, buffer.Length, name: name); break; } else { goto Break; }
                //				case States.Flags:
                //					//if (TryReadByte(buffer, ref position, out flags)) { state = States.Remaining; Decode($" [{flags}]", state, buffer.Length); break; } else { goto Break; }
                //					if (TryReadUInt16BigEndian(buffer, ref position, out var _flags))
                //					{
                //						state = States.TypeDispatch;
                //						type = Header.MakeType(_flags);
                //						flags = Header.MakeFlags(_flags);
                //						Decode($" [{type} {(Header.HasIgnore(flags) ? "Ignore" : "NoIgnore")} {(Header.HasMetadata(flags) ? "Metadata" : "NoMetadata")} Flags ({flags:X3})]", state, buffer.Length, name: name);
                //						goto case States.TypeDispatch;
                //					}
                //					else { goto Break; }
                //				case States.TypeDispatch:
                //					switch (type)
                //					{
                //						case Types.Payload: state = States.Payload; break;
                //						default: throw new InvalidOperationException($"Handler State {state} Invalid Dispatch Type {type}!");
                //					}
                //					break;

                //				case States.Payload:
                //					//TODO !complete & !next fails.
                //					if (Payload.HasMetadata(flags)) goto case States.PayloadMetadata;
                //					if (Payload.HasNext(flags)) goto case States.PayloadData;

                //					//TODO verify with protocol.
                //					OnPayload(sink, new Payload(stream, Span<byte>.Empty, follows: Payload.HasFollows(flags), complete: Payload.HasComplete(flags), next: Payload.HasNext(flags)));
                //					break;
                //				case States.PayloadMetadata:
                //					break;
                //				case States.PayloadData:
                //					//TODO Allow zero byte payload
                //					if (TryReadAll(buffer, ref position, out var data))
                //					{
                //						OnPayload(sink, new Payload(stream, data, follows: Payload.HasFollows(flags), complete: Payload.HasComplete(flags), next: Payload.HasNext(flags)));
                //						goto case States.Done;
                //					}
                //					break;
                //				case States.Done: state = States.Length; break;     //TODO isEOM handling...
                //				default: throw new InvalidOperationException($"State Machine Overflow at {state}!");
                //			}
                //			buffer = buffer.Slice(position);    //TODO goto case
                //		}
                //		Break:
                //		Operation(buffer.IsEmpty ? $"{name} Recycling with Empty Buffer" : $"{name} Recycling with Partial Buffer", BufferLength: buffer.Length);
                //		pipereader.AdvanceTo(position, buffer.End);
                //	}
            }
        }
Exemple #30
0
 /// <summary>
 /// Causes a communication object to transition immediately from its current state into the closed state.
 /// </summary>
 void ICommunicationObject.Abort()
 {
     RequestChannel.Abort();
 }
Exemple #31
0
 /// <summary>
 /// Begins an asynchronous operation to open a communication object within a specified interval of time.
 /// </summary>
 /// <param name="timeout">
 /// The <see cref="TimeSpan" /> that specifies how long the open operation has to complete before timing out.
 /// </param>
 /// <param name="callback">
 /// The <see cref="AsyncCallback" /> delegate that receives notification of the completion of the asynchronous
 /// close operation.
 /// </param>
 /// <param name="state">
 /// An object, specified by the application, that contains state information associated with the asynchronous
 /// close operation.
 /// </param>
 /// <returns>The <see cref="IAsyncResult" /> that references the asynchronous open operation.</returns>
 IAsyncResult ICommunicationObject.BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
 {
     return(RequestChannel.BeginOpen(timeout, callback, state));
 }
Exemple #32
0
 /// <summary>
 /// Causes a communication object to transition from its current state into the closed state.
 /// </summary>
 /// <param name="timeout">
 /// The <see cref="TimeSpan" /> that specifies how long the open operation has to complete before timing out.
 /// </param>
 void ICommunicationObject.Close(TimeSpan timeout)
 {
     RequestChannel.Close(timeout);
 }
Exemple #33
0
 /// <summary>
 /// Causes a communication object to transition from its current state into the closed state.
 /// </summary>
 void ICommunicationObject.Close()
 {
     RequestChannel.Close();
 }
Exemple #34
0
 /// <summary>
 /// Causes a communication object to transition from the created state into the opened state.
 /// </summary>
 void ICommunicationObject.Open()
 {
     RequestChannel.Open();
 }
Exemple #35
0
 /// <summary>
 /// Causes a communication object to transition from the created state into the opened state within a specified interval of time.
 /// </summary>
 /// <param name="timeout">
 /// The <see cref="TimeSpan" /> that specifies how long the open operation has to complete before timing out.
 /// </param>
 void ICommunicationObject.Open(TimeSpan timeout)
 {
     RequestChannel.Open(timeout);
 }
Exemple #36
0
 /// <summary>
 /// Completes an asynchronous operation to open a communication object.
 /// </summary>
 /// <param name="result">The <see cref="IAsyncResult" /> that is returned by a call to the BeginClose() method.</param>
 void ICommunicationObject.EndOpen(IAsyncResult result)
 {
     RequestChannel.EndOpen(result);
 }