示例#1
0
        public override SrvLookup <TService> Start()
        {
            if (RunOnce)
            {
                return(this);
            }

            // Query DNS servers (SRV Required, TXT Optional)
            var tasks = new[] { SrvQuery.Resolve(), TxtQuery.TryResolve() };

            CTask.WhenAll(tasks).ContinueWith(t =>
            {
                try
                {
                    DnsEntries = t.Result[0].Union(t.Result[1]).ToArray();
                    Completion.SetResult(ResultFactory);
                }
                catch (Exception ex)
                {
                    Completion.SetException(ex);
                }
            });

            return(this);
        }
示例#2
0
        public virtual SrvLookup <TService> Start()
        {
            if (RunOnce)
            {
                return(this);
            }

            // Query DNS servers
            SrvQuery.Resolve().ContinueWith(t =>
            {
                try
                {
                    DnsEntries = t.Result;
                    Completion.SetResult(ResultFactory);
                }
                catch (Exception ex)
                {
                    Completion.SetException(ex);
                }
            });

            return(this);
        }