コード例 #1
0
        public DiscoveryMessageSequence GetMessageSequence(EndpointDiscoveryMetadata endpointDiscoveryMetadata)
        {
            if (endpointDiscoveryMetadata == null)
            {
                throw FxTrace.Exception.ArgumentNull("endpointDiscoveryMetadata");
            }

            DiscoveryMessageSequence messageSequence = null;

            if (!this.messageSequenceTable.TryGetValue(endpointDiscoveryMetadata, out messageSequence))
            {
                throw FxTrace.Exception.Argument("endpointDiscoveryMetadata", SR2.DiscoveryFindResponseMessageSequenceNotFound);
            }

            return(messageSequence);
        }
コード例 #2
0
        //-----------------------------------------------------
        //  Online Announcements
        //-----------------------------------------------------

        #region OnlineAnnouncement

        /// <summary>
        /// Handles an online announcement message.
        /// </summary>
        /// <param name="messageSequence">The discovery message sequence.</param>
        /// <param name="endpointDiscoveryMetadata">The endpoint discovery metadata.</param>
        /// <param name="callback">The callback delegate to call when the operation is completed.</param>
        /// <param name="state">The user-defined state data.</param>
        /// <returns>A reference to the pending asynchronous operation.</returns>
        protected override IAsyncResult OnBeginOnlineAnnouncement(DiscoveryMessageSequence messageSequence,
                                                                  EndpointDiscoveryMetadata endpointDiscoveryMetadata,
                                                                  AsyncCallback callback, object state)
        {
            var tcs = new TaskCompletionSource <object>(state);

            // Start a background task that will process anounncement
            Task.Factory.StartNew(() =>
            {
                // Create and executy all Online announcement tasks
                var tasks = _onlineTaskFactories.AsParallel()
                            .Select((factory) => { return(factory.Create(new DiscoveryMessageSequence[] { messageSequence },
                                                                         new EndpointDiscoveryMetadata[] { endpointDiscoveryMetadata })); })
                            .ToArray();
                // TODO: Decide if we want to wait for completion of all tasks
                // Task.WaitAll(tasks);
                tcs.SetResult(null);
                callback(tcs.Task);
            });

            return(tcs.Task);
        }
コード例 #3
0
 protected abstract IAsyncResult BeginSendProxyAnnouncement(
     TResponseChannel responseChannel,
     DiscoveryMessageSequence discoveryMessageSequence,
     EndpointDiscoveryMetadata proxyEndpointDiscoveryMetadata,
     AsyncCallback callback,
     object state);
コード例 #4
0
 protected abstract IAsyncResult BeginSendResolveResponse(
     TResponseChannel responseChannel,
     DiscoveryMessageSequence discoveryMessageSequence,
     EndpointDiscoveryMetadata matchingEndpoint,
     AsyncCallback callback,
     object state);
コード例 #5
0
 internal void AddDiscoveredEndpoint(EndpointDiscoveryMetadata endpointDiscoveryMetadata,
                                     DiscoveryMessageSequence messageSequence)
 {
     this.messageSequenceTable.Add(endpointDiscoveryMetadata, messageSequence);
     this.endpoints.Add(endpointDiscoveryMetadata);
 }
コード例 #6
0
 /// <summary>
 /// Handles Offline announcements.
 /// </summary>
 /// <param name="messageSequence">The array discovery message sequence.</param>
 /// <param name="endpointDiscoveryMetadata">The array of endpoint discovery metadata.</param>
 protected abstract void OnOfflineAnnouncement(DiscoveryMessageSequence messageSequence,
                                               EndpointDiscoveryMetadata endpointDiscoveryMetadata);
コード例 #7
0
 protected abstract TResponseMessage GetResolveResponse(
     DiscoveryMessageSequence discoveryMessageSequence,
     EndpointDiscoveryMetadata matchingEndpoints);
コード例 #8
0
ファイル: DiscoveryProxy.cs プロジェクト: dox0/DotNet471RS3
 protected abstract IAsyncResult OnBeginOfflineAnnouncement(
     DiscoveryMessageSequence messageSequence,
     EndpointDiscoveryMetadata endpointDiscoveryMetadata,
     AsyncCallback callback,
     object state);
コード例 #9
0
 internal FindProgressChangedEventArgs(int progressPercentage, object userState,
                                       EndpointDiscoveryMetadata endpointDiscoveryMetadata, DiscoveryMessageSequence messageSequence)
     : base(progressPercentage, userState)
 {
     this.endpointDiscoveryMetadata = endpointDiscoveryMetadata;
     this.messageSequence           = messageSequence;
 }
コード例 #10
0
 internal FindProgressChangedEventArgs(EndpointDiscoveryMetadata metadata, DiscoveryMessageSequence sequence, int progressPercentage, object userState)
     : base(progressPercentage, userState)
 {
     EndpointDiscoveryMetadata = metadata;
     MessageSequence           = sequence;
 }
コード例 #11
0
 internal ResolveResponse(EndpointDiscoveryMetadata metadata, DiscoveryMessageSequence sequence)
 {
     EndpointDiscoveryMetadata = metadata;
     MessageSequence           = sequence;
 }
コード例 #12
0
 internal AnnouncementEventArgs(EndpointDiscoveryMetadata metadata, DiscoveryMessageSequence queue)
 {
     EndpointDiscoveryMetadata = metadata;
     MessageSequence           = queue;
 }
 protected abstract TResponseMessage GetProbeResponse(
     DiscoveryMessageSequence discoveryMessageSequence,
     Collection <EndpointDiscoveryMetadata> matchingEndpoints);