Beispiel #1
0
        /// <summary>
        /// Removes and sets all generic properties of a Protocol, then passes remainder of properties on to implementation
        /// </summary>
        /// <param name="properties">Collection of properties</param>
        /// <returns>False if properties were specified that are not know, otherwise true</returns>
        public bool setPropertiesInternal(PropertyCollection properties)
        {
            this.props = properties;

            if(props.Contains("down_thread"))
            {
                down_thread = Convert.ToBoolean(props["down_thread"]);
                props.Remove("down_thread");
            }

            if(props.Contains("up_thread"))
            {
                up_thread = Convert.ToBoolean(props["up_thread"]);
                props.Remove("up_thread");
            }

            return setProperties(props);
        }
        /// <summary>
        /// Sets the properties specified in the configuration string
        /// </summary>
        /// <param name="props">Properties to set</param>
        /// <returns>False if properties were specified that are not know, otherwise true</returns>
        public override bool setProperties(PropertyCollection props)
        {
            if(props.Contains("timeout"))
            {
                timeout = Convert.ToInt64(props["timeout"]);
                props.Remove("timeout");
            }

            if(props.Contains("num_msgs"))
            {
                num_msgs = Convert.ToInt32(props["num_msgs"]);
                if(num_msgs <= 0)
                {
                    if(Trace.trace)
                        Trace.warn("VERIFY_SUSPECT.setProperties()", "num_msgs is invalid (" +
                        num_msgs + "): setting it to 1");
                    num_msgs=1;
                }
                props.Remove("num_msgs");
            }

            if(props.Count > 0)
            {
                return false;
            }
            return true;
        }
Beispiel #3
0
        /// <summary>
        /// Sets the properties specified in the configuration string
        /// </summary>
        /// <param name="props">Properties to set</param>
        /// <returns>False if properties were specified that are not know, otherwise true</returns>
        public override bool setProperties(PropertyCollection props)
        {
            if(props.Contains("shun"))
            {
                shun = Convert.ToBoolean(props["shun"]);
                props.Remove("shun");
            }
            if(props.Contains("print_local_addr"))
            {
                print_local_addr = Convert.ToBoolean(props["print_local_addr"]);
                props.Remove("print_local_addr");
            }
            if(props.Contains("join_timeout"))
            {
                join_timeout = Convert.ToInt64(props["join_timeout"]);
                props.Remove("join_timeout");
            }
            if(props.Contains("join_retry_timeout"))
            {
                join_retry_timeout = Convert.ToInt64(props["join_retry_timeout"]);
                props.Remove("join_retry_timeout");
            }
            if(props.Contains("leave_timeout")) // time to wait until coord responds to LEAVE req.
            {
                leave_timeout = Convert.ToInt64(props["leave_timeout"]);
                props.Remove("leave_timeout");
            }
            if(props.Contains("digest_timeout")) // time to wait for GET_DIGEST_OK from PBCAST
            {
                digest_timeout = Convert.ToInt64(props["digest_timeout"]);
                props.Remove("digest_timeout");
            }
            if(props.Contains("disable_initial_coord")) // time to wait for GET_DIGEST_OK from PBCAST
            {
                disable_initial_coord = Convert.ToBoolean(props["disable_initial_coord"]);
                props.Remove("disable_initial_coord");
            }

            if(props.Count > 0)
            {
                return false;
            }
            return true;
        }
Beispiel #4
0
        /// <summary>
        /// Sets the properties specified in the configuration string
        /// </summary>
        /// <param name="props">Properties to set</param>
        /// <returns>False if properties were specified that are not know, otherwise true</returns>
        public override bool setProperties(PropertyCollection props)
        {
            if(props.Contains("num_initial_members"))
            {
                num_initial_members = Convert.ToInt32(props["num_initial_members"]);
                props.Remove("num_initial_members");
            }
            if(props.Contains("timeout"))
            {
                timeout = Convert.ToInt64(props["timeout"]);
                props.Remove("timeout");
            }

            if (props.Count > 0)
                return false;

            return true;
        }
Beispiel #5
0
        /// <summary>
        /// Sets the properties specified in the configuration string
        /// </summary>
        /// <param name="props">Properties to set</param>
        /// <returns>False if properties were specified that are not know, otherwise true</returns>
        public override bool setProperties(PropertyCollection props)
        {
            if(props.Contains("mcast_addr"))
            {
                mcast_addr.IP = IPAddress.Parse(Convert.ToString(props["mcast_addr"]));
                props.Remove("mcast_addr");
            }
            if(props.Contains("mcast_port"))
            {
                mcast_addr.Port = Convert.ToInt32(props["mcast_port"]);
                props.Remove("mcast_port");
            }
            if(props.Contains("bind_addr"))
            {
                bind_addr.IP = IPAddress.Parse(Convert.ToString(props["bind_addr"]));
                props.Remove("bind_addr");
            }
            if(props.Contains("bind_port"))
            {
                bind_addr.Port = Convert.ToInt32(props["mcast_port"]);
                props.Remove("mcast_port");
            }
            if(props.Contains("ip_ttl"))
            {
                ip_ttl = Convert.ToInt32(props["ip_ttl"]);
                props.Remove("ip_ttl");
            }
            if(props.Contains("bind_port"))
            {
                bind_addr.Port = Convert.ToInt32(props["bind_port"]);
                props.Remove("bind_port");
            }
            if(props.Contains("mcast_send_buf_size"))
            {
                mcast_send_buf_size = Convert.ToInt32(props["mcast_send_buf_size"]);
                props.Remove("mcast_send_buf_size");
            }
            if(props.Contains("mcast_recv_buf_size"))
            {
                mcast_recv_buf_size = Convert.ToInt32(props["mcast_recv_buf_size"]);
                props.Remove("mcast_recv_buf_size");
            }
            if(props.Contains("ucast_send_buf_size"))
            {
                ucast_send_buf_size = Convert.ToInt32(props["ucast_send_buf_size"]);
                props.Remove("ucast_send_buf_size");
            }
            if(props.Contains("ucast_recv_buf_size"))
            {
                ucast_recv_buf_size = Convert.ToInt32(props["ucast_recv_buf_size"]);
                props.Remove("ucast_recv_buf_size");
            }

            if (props.Count > 0)
                return false;

            return true;
        }
Beispiel #6
0
        /// <summary>
        /// Sets the properties specified in the configuration string
        /// </summary>
        /// <param name="props">Properties to set</param>
        /// <returns>False if properties were specified that are not know, otherwise true</returns>
        public override bool setProperties(PropertyCollection props)
        {
            if(props.Contains("digest_timeout"))
            {
                digest_timeout = Convert.ToInt64(props["digest_timeout"]);
                props.Remove("digest_timeout");
            }
            if(props.Contains("desired_avg_gossip"))
            {
                desired_avg_gossip = Convert.ToInt64(props["desired_avg_gossip"]);
                props.Remove("desired_avg_gossip");
            }
            if(props.Contains("stability_delay"))
            {
                stability_delay = Convert.ToInt64(props["stability_delay"]);
                props.Remove("stability_delay");
            }
            if(props.Contains("max_gossip_runs"))
            {
                max_gossip_runs = Convert.ToInt32(props["max_gossip_runs"]);
                num_gossip_runs=max_gossip_runs;
                props.Remove("max_gossip_runs");
            }

            if(props.Count > 0)
            {
                return false;
            }
            return true;
        }
Beispiel #7
0
 /// <summary>
 /// Sets the properties specified in the configuration string
 /// </summary>
 /// <param name="props">Properties to set</param>
 /// <returns>False if properties were specified that are not know, otherwise true</returns>
 public override bool setProperties(PropertyCollection props)
 {
     if(props.Contains("retransmit_timeout"))
     {
         String[] strArray = Convert.ToString(props["retransmit_timeout"]).Split(new Char[] {','});
         for(int i = 0 ; i<strArray.Length;i++)
         {
             retransmit_timeout[i] = Convert.ToInt64(strArray[i]);
         }
         props.Remove("retransmit_timeout");
     }
     if(props.Contains("gc_lag"))
     {
         gc_lag =  Convert.ToInt32(props["gc_lag"]);
         if(gc_lag < 1)
         {
             if(Trace.trace)
                 Trace.error("NAKACK.setProperties()","gc_lag has to be at least 1 (set to 10)");
             gc_lag=10;
         }
         props.Remove("gc_lag");
     }
     if(props.Contains("max_xmit_size"))
     {
         max_xmit_size =  Convert.ToInt64(props["max_xmit_size"]);
         props.Remove("max_xmit_size");
     }
     if(props.Count > 0)
     {
         return false;
     }
     return true;
 }
Beispiel #8
0
        /// <summary>
        /// Sets the properties specified in the configuration string
        /// </summary>
        /// <param name="props">Properties to set</param>
        /// <returns>False if properties were specified that are not know, otherwise true</returns>
        public override bool setProperties(PropertyCollection props)
        {
            if(props.Contains("timeout"))
            {
                String[] strArray = Convert.ToString(props["timeout"]).Split(new Char[] {','});
                for(int i = 0 ; i<strArray.Length;i++)
                {
                    timeout[i] = Convert.ToInt64(strArray[i]);
                }
                props.Remove("timeout");
            }
            if(props.Contains("window_size"))
            {
                window_size = Convert.ToInt32(props["window_size"]);
                props.Remove("window_size");
            }
            if(props.Contains("min_threshold"))
            {
                min_threshold = Convert.ToInt32(props["min_threshold"]);
                props.Remove("min_threshold");
            }

            if(props.Count > 0)
            {
                return false;
            }

            // Some sanity checks
            if((window_size > 0 && min_threshold <= 0) || (window_size <= 0 && min_threshold > 0))
            {
                if(Trace.trace)
                    Trace.error("UNICAST.setProperties()",
                    "window_size and min_threshold have to be both set if one of them is set");
                return false;
            }
            if(window_size > 0 && min_threshold > 0 && window_size < min_threshold)
            {
                if(Trace.trace)
                    Trace.error("UNICAST.setProperties()", "min_threshold (" + min_threshold +
                    ") has to be less than window_size (" + window_size + ")");
                return false;
            }
            return true;
        }
Beispiel #9
0
        /// <summary>
        /// Sets the properties specified in the configuration string
        /// </summary>
        /// <param name="props">Properties to set</param>
        /// <returns>False if properties were specified that are not know, otherwise true</returns>
        public override bool setProperties(PropertyCollection props)
        {
            if(props.Contains("up"))
            {
                probUp = Convert.ToDouble(props["up"]);
                props.Remove("up");
            }
            if(props.Contains("down"))
            {
                probDown = Convert.ToDouble(props["down"]);
                props.Remove("down");
            }
            if(props.Contains("excludeItself"))
            {
                excludeItself = Convert.ToBoolean(props["excludeItself"]);
                props.Remove("excludeItself");
            }

            if (props.Count > 0)
            {
                return false;
            }
            return true;
        }
Beispiel #10
0
        /// <summary>
        /// Sets the properties specified in the configuration string
        /// </summary>
        /// <param name="props">Properties to set</param>
        /// <returns>False if properties were specified that are not know, otherwise true</returns>
        public override bool setProperties(PropertyCollection props)
        {
            if(props.Contains("timeout"))
            {
                timeout = Convert.ToInt64(props["timeout"]);
                props.Remove("timeout");
            }
            if(props.Contains("max_tries"))
            {
                max_tries = Convert.ToInt32(props["max_tries"]);
                props.Remove("max_tries");
            }
            if(props.Contains("shun"))
            {
                shun = Convert.ToBoolean(props["shun"]);
                props.Remove("shun");
            }

            if (props.Count > 0)
                return false;
            return true;
        }