Exemplo n.º 1
0
 protected override IAsyncResult BeginSendFindResponse(
     IDiscoveryResponseContractCD1 responseChannel,
     DiscoveryMessageSequence discoveryMessageSequence,
     EndpointDiscoveryMetadata matchingEndpoint,
     AsyncCallback callback,
     object state)
 {
     return(responseChannel.BeginProbeMatchOperation(
                ProbeMatchesMessageCD1.Create(
                    discoveryMessageSequence,
                    matchingEndpoint),
                callback,
                state));
 }
Exemplo n.º 2
0
        public void EndProbeOperation(IAsyncResult result)
        {
            ProbeMatchesMessageCD1 response = base.Channel.EndProbeOperation(result);
            AsyncOperationContext  context  = (AsyncOperationContext)result.AsyncState;

            if ((response != null) && (response.ProbeMatches != null))
            {
                this.responseReceiver.ProbeMatchOperation(
                    context.OperationId,
                    DiscoveryUtility.ToDiscoveryMessageSequenceOrNull(response.MessageSequence),
                    DiscoveryUtility.ToEndpointDiscoveryMetadataCollection(response.ProbeMatches),
                    true);
            }
            else
            {
                this.responseReceiver.PostFindCompletedAndRemove(context.OperationId, false, null);
            }
        }
Exemplo n.º 3
0
        public void ProbeOperation(FindCriteria findCriteria)
        {
            ProbeMessageCD1 request = new ProbeMessageCD1();

            request.Probe = FindCriteriaCD1.FromFindCriteria(findCriteria);

            ProbeMatchesMessageCD1 response = base.Channel.ProbeOperation(request);

            if ((response != null) && (response.ProbeMatches != null))
            {
                this.responseReceiver.ProbeMatchOperation(
                    OperationContext.Current.IncomingMessageHeaders.RelatesTo,
                    DiscoveryUtility.ToDiscoveryMessageSequenceOrNull(response.MessageSequence),
                    DiscoveryUtility.ToEndpointDiscoveryMetadataCollection(response.ProbeMatches),
                    true);
            }
            else
            {
                this.responseReceiver.PostFindCompletedAndRemove(OperationContext.Current.IncomingMessageHeaders.RelatesTo, false, null);
            }
        }
        public IAsyncResult BeginProbeMatchOperation(ProbeMatchesMessageCD1 response, AsyncCallback callback, object state)
        {
            Fx.Assert(response != null, "The response message cannot be null.");
            if ((response.MessageSequence != null) && (response.ProbeMatches != null))
            {
                this.responseReceiver.ProbeMatchOperation(
                    OperationContext.Current.IncomingMessageHeaders.RelatesTo,
                    response.MessageSequence.ToDiscoveryMessageSequence(),
                    DiscoveryUtility.ToEndpointDiscoveryMetadataCollection(response.ProbeMatches),
                    false);
            }
            else
            {
                if (response.MessageSequence == null && TD.DiscoveryMessageWithNullMessageSequenceIsEnabled())
                {
                    TD.DiscoveryMessageWithNullMessageSequence(
                        ProtocolStrings.TracingStrings.ProbeMatches,
                        OperationContext.Current.IncomingMessageHeaders.MessageId.ToString());
                }
            }

            return(new CompletedAsyncResult(callback, state));
        }