Пример #1
0
        /// <summary>
        /// Tests a remote master server link by requesting PING
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public bool TestLink(int index)
        {
#if !WCF
#warning "WCF functionality disabled - ServerList RPC will not function"
#else
            if (index > -1 && index < MasterServer.Settings.SyncServiceUris.Count)
            {
                string             remoteMasterUri = MasterServer.Settings.SyncServiceUris[index];
                RemoteMasterServer testMe          = GetRemoteServer(remoteMasterUri);

                if (testMe != null)
                {
                    MasterServer.Log("[RPC] Testing connection to {0}", testMe.InnerChannel.RemoteAddress.Uri.Host);
                    try
                    {
                        string pingResponse = testMe.Ping();
                        MasterServer.Log("[RPC] Test link succeeded.");
                        return(true);
                    }
                    catch (MessageSecurityException)
                    {
                        MasterServer.Log("[RPC] Test link failed: credentials rejected by remote server");
                    }
                    catch (CommunicationException ex)
                    {
                        MasterServer.Log("[RPC] Test link failed:");
                        MasterServer.Log("[RPC] {0}", ex.Message);
                    }
                }
            }
#endif
            return(false);
        }
Пример #2
0
        /// <summary>
        /// Remove a remote master server entry
        /// </summary>
        /// <param name="remoteMasterUri"></param>
        private void RemoveRemoteServer(string remoteMasterUri)
        {
            RemoteMasterServer removeMe = GetRemoteServer(remoteMasterUri);

            if (removeMe != null)
            {
                remoteMasters.Remove(removeMe);
            }
        }