/// <summary>
        /// Constructs the state object.
        /// </summary>
        static EmitterStatus()
        {
            try
            {
                // Prepare the datastructure
                Default         = new EmitterStatus();
                Default.Network = new EmitterStatusNetwork();

                // Use the provider and get the external ip
                Address = EmitterConfig.Default.Cluster.BroadcastEndpoint.ToString();

                // Hash both values into one integer
                NodeIdentifier = Murmur32.GetHash(Address);
            }
            catch (Exception ex)
            {
                // Log the exception here
                Service.Logger.Log(ex);
            }
        }
Exemple #2
0
 /// <summary>
 /// Gets the node identifier from the endpoint.
 /// </summary>
 /// <param name="ep">The endpoint to convert.</param>
 /// <returns></returns>
 internal static int ToIdentifier(this IPEndPoint ep)
 {
     return(Murmur32.GetHash(ep.ToString()));
 }
Exemple #3
0
 /// <summary>
 /// Gets the murmur hash code for the type.
 /// </summary>
 /// <param name="source"></param>
 /// <returns></returns>
 public static int ToIdentifier(this Type source)
 {
     return(Murmur32.GetHash(source.FullName));
 }