Inheritance: IServerDistanceInfo
Ejemplo n.º 1
0
 protected override void OnDistanceInfo(ServerDistanceInfo sdi)
 {
     if (sdi.IsReachable && (HydraServer == null || (HydraServer != sdi.Name && sdi.Distance < Distances.ServerInfo[HydraServer].Distance - Tolerance))) {
         // There is a better server than the current one
         HydraServer = sdi.Name;
     } else if (!sdi.IsReachable && HydraServer == sdi.Name) {
         // The current server is no longer responding - replace with the nearest reachable one, or null if none are reachable
         HydraServer = Distances.ServerInfo.Values.Where(sdi1 => sdi1.IsReachable).OrderBy(sdi1 => sdi1.Distance).Select(sdi1 => sdi1.Name).FirstOrDefault();
     } else if (!Initialised && !sdi.IsReachable && Distances.ServerInfo.Count == StoreDict.Count) {
         // All servers are unreachable so initialisation is done
         FinishedInitialisation();
     }
 }
Ejemplo n.º 2
0
 protected virtual void OnDistanceInfo(ServerDistanceInfo sdi)
 {
 }