Пример #1
0
        /// <summary>
        /// Returns the servers known to the discovery endpoint.
        /// </summary>
        public FindServersResponseMessage FindServers(FindServersMessage request)
        {
            lock (m_lock)
            {
                // update the list of supported endpoints by looking in the service description associated with the host.
                InitializeApplicationDescription();

                FindServersResponseMessage response = new FindServersResponseMessage();

                response.ResponseHeader = CreateResponseHeader(request.RequestHeader);
                response.Servers = new ListOfApplicationDescription();

                // only one server to return must still must check the filter if specified.
                bool filtered = false;

                if (request.ServerUris != null && request.ServerUris.Count != 0)
                {
                    filtered = true;

                    foreach (string serverUri in request.ServerUris)
                    {
                        if (serverUri == m_application.ApplicationUri)
                        {
                            filtered = false;
                            break;
                        }
                    }
                }

                // return an empty list if no match on the filter.
                if (!filtered)
                {
                    response.Servers.Add(m_application);
                }

                return response;
            }
        }