Пример #1
0
 public HOptions(HOptions options)
 {
     SetEndpoints(options.GetEndpoints());
     SetTransport(options.GetTransport());
     SetTimeout(options.GetTimeout());
     SetMsgTimeout(options.GetMsgTimeout());
 }
Пример #2
0
        private void fillTransportOptions(string login, string password, HOptions options, JObject context)
        {
            try
            {

                this.transportOptions.Login = login;
                this.transportOptions.Password = password;
                this.transportOptions.Timeout = options.GetTimeout();
                this.transportOptions.AuthCb = options.AuthCb;

                //for endpoints, pick one randomly and fill transport options
                if (options.GetEndpoints().Count() > 0)
                {
                    int endpointIndex = HUtil.PickIndex(options.GetEndpoints());
                    string endpoint = options.GetEndpoints()[endpointIndex].ToString();

                    transportOptions.EndpointHost = HUtil.GetHost(endpoint);
                    transportOptions.EndpointPort = HUtil.GetPort(endpoint);
                    transportOptions.EndpointPath = HUtil.GetPath(endpoint);
                }
                else
                {
                    transportOptions.EndpointHost = null;
                    transportOptions.EndpointPort = 0;
                    transportOptions.EndpointPath = null;
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine("{0} : ", e);
            }
        }