Beispiel #1
0
 public virtual void ChangeConstraints(ConnectionConstraints constraints)
 {
     ServerManager connManager;
     try
     {
         connManager = this.ConnManager;
     }
     catch (SubscrException)
     {
         return;
     }
     try
     {
         connManager.ChangeConstraints(constraints);
     }
     catch (PhaseException)
     {
     }
 }
 private static void AddConstraints(IDictionary parameters, ConnectionConstraints constraints)
 {
     if (!(constraints.maxBandwidth == -1.0))
     {
         parameters["LS_requested_max_bandwidth"] = constraints.maxBandwidth.ToString();
     }
 }
 internal virtual Stream CallResync(PushServerProxy.PushServerProxyInfo pushInfo, ConnectionConstraints newConstraints)
 {
     IDictionary parameters = new Dictionary<string, string>();
     parameters["LS_session"] = pushInfo.sessionId;
     if (newConstraints != null)
     {
         this.info.constraints = (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));
     }
     parameters["LS_silverlight_version"] = Constants.localVersion;
     bool flag = !this.info.isPolling && this.info.useGetForStreaming;
     return provider.DoHTTP(parameters, !flag);
 }
 internal virtual void CallConstrainRequest(PushServerProxy.PushServerProxyInfo pushInfo, ConnectionConstraints newConstraints)
 {
     IDictionary parameters = new Dictionary<string, string>();
     parameters["LS_session"] = pushInfo.sessionId;
     parameters["LS_op"] = "constrain";
     this.info.constraints = (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);
     }
     catch (PushEndException)
     {
         throw new PushServerException(7);
     }
     finally
     {
         try
         {
             streamLogger.Debug("Closing constrain connection");
             notBatchedAnswer.Close();
         }
         catch (IOException exception)
         {
             streamLogger.Debug("Error closing constrain connection", exception);
         }
     }
 }
 internal virtual void RequestNewConstraints(ConnectionConstraints constraints)
 {
     this.Check();
     try
     {
         this.serverTranslator.CallConstrainRequest(this.serverInfo, constraints);
     }
     catch (PushUserException exception)
     {
         protLogger.Debug("Refused constraints request", exception);
         throw new PushServerException(9);
     }
     catch (IOException exception2)
     {
         throw new PushConnException(exception2);
     }
     catch (WebException exception3)
     {
         throw new PushConnException(exception3);
     }
     this.Check();
 }