private static void AddConstraints(Hashtable parameters, Lightstreamer.DotNet.Client.ConnectionConstraints constraints)
 {
     if (!(constraints.maxBandwidth == -1.0))
     {
         parameters["LS_requested_max_bandwidth"] = constraints.maxBandwidth.ToString();
     }
     if (!(constraints.topMaxFrequency == -1.0))
     {
         parameters["LS_top_max_frequency"] = constraints.topMaxFrequency.ToString();
     }
     else if (!(constraints.slowingFactor == -1.0))
     {
         parameters["LS_slowing_factor"] = constraints.slowingFactor.ToString();
     }
 }
Пример #2
0
        public virtual void ChangeConstraints(Lightstreamer.DotNet.Client.ConnectionConstraints constraints)
        {
            ServerManager connManager;

            try
            {
                connManager = this.ConnManager;
            }
            catch (SubscrException)
            {
                return;
            }
            try
            {
                connManager.ChangeConstraints(constraints);
            }
            catch (PhaseException)
            {
            }
        }
 internal virtual void RequestNewConstraints(Lightstreamer.DotNet.Client.ConnectionConstraints constraints)
 {
     this.Check();
     try
     {
         this.serverTranslator.CallConstrainRequest(this.serverInfo, constraints);
     }
     catch (PushUserException exception)
     {
         protLogger.Debug("Refused constraints request", exception);
         throw new PushServerException(7);
     }
     catch (IOException exception2)
     {
         throw new PushConnException(exception2);
     }
     catch (WebException exception3)
     {
         throw new PushConnException(exception3);
     }
     this.Check();
 }
Пример #4
0
 public override bool Equals(object other)
 {
     if (other != this)
     {
         if (other == null)
         {
             return(false);
         }
         Lightstreamer.DotNet.Client.ConnectionConstraints constraints = (Lightstreamer.DotNet.Client.ConnectionConstraints)other;
         if (!(constraints.topMaxFrequency == this.topMaxFrequency))
         {
             return(false);
         }
         if (!(constraints.slowingFactor == this.slowingFactor))
         {
             return(false);
         }
         if (!(constraints.maxBandwidth == this.maxBandwidth))
         {
             return(false);
         }
     }
     return(true);
 }
        internal virtual void CallConstrainRequest(PushServerProxy.PushServerProxyInfo pushInfo, Lightstreamer.DotNet.Client.ConnectionConstraints newConstraints)
        {
            Hashtable parameters = new Hashtable();

            parameters["LS_session"] = pushInfo.sessionId;
            parameters["LS_op"]      = "constrain";
            this.info.constraints    = (Lightstreamer.DotNet.Client.ConnectionConstraints)newConstraints.Clone();
            AddConstraints(parameters, this.info.constraints);
            string       controlUrl       = pushInfo.controlAddress + "/lightstreamer/control.txt";
            StreamReader notBatchedAnswer = this.batchManager.GetNotBatchedAnswer(controlUrl, parameters);

            try
            {
                this.CheckAnswer(notBatchedAnswer);
            }
            finally
            {
                try
                {
                    streamLogger.Debug("Closing connection");
                    notBatchedAnswer.Close();
                }
                catch (IOException exception)
                {
                    streamLogger.Debug("Error closing connection", exception);
                }
            }
        }
        internal virtual Stream CallResync(PushServerProxy.PushServerProxyInfo pushInfo, Lightstreamer.DotNet.Client.ConnectionConstraints newConstraints)
        {
            Hashtable parameters = new Hashtable();

            parameters["LS_session"] = pushInfo.sessionId;
            if (newConstraints != null)
            {
                this.info.constraints = (Lightstreamer.DotNet.Client.ConnectionConstraints)newConstraints.Clone();
            }
            AddConnectionProperties(parameters, this.info);
            AddConstraints(parameters, this.info.constraints);
            HttpProvider provider = new HttpProvider(pushInfo.rebindAddress + "/lightstreamer/bind_session.txt");

            protLogger.Info("Opening stream connection to rebind current session");
            if (protLogger.IsDebugEnabled)
            {
                protLogger.Debug("Rebinding params: " + CollectionsSupport.ToString(parameters));
            }
            return(provider.DoPost(parameters));
        }
Пример #7
0
 internal virtual void ChangeConstraints(Lightstreamer.DotNet.Client.ConnectionConstraints constraints)
 {
     this.localPushServerProxy.RequestNewConstraints(constraints);
 }