Beispiel #1
0
 internal ServerManager(ConnectionInfo info, IServerListener asyncListener)
 {
     this.connInfo = info;
     this.localPushServerProxy = new PushServerProxy(info);
     this.activityController = new ActivityController(this);
     this.serverListener = asyncListener;
 }
Beispiel #2
0
        internal ServerManager(ConnectionInfo info, IConnectionListener listener, IServerListener asyncListener)
        {
            Stream stream = null;

            this.probeTimeoutMillis        = info.probeTimeoutMillis;
            this.probeWarningMillis        = info.probeWarningMillis;
            this.reconnectionTimeoutMillis = info.reconnectionTimeoutMillis;
            this.localPushServerProxy      = new PushServerProxy(info);
            try
            {
                stream = this.localPushServerProxy.ConnectForSession();
                try
                {
                    listener.OnConnectionEstablished();
                }
                catch (Exception)
                {
                }
                this.localPushServerProxy.StartSession(stream);
                try
                {
                    listener.OnSessionStarted();
                }
                catch (Exception)
                {
                }
            }
            catch (PhaseException)
            {
            }
            this.serverListener = asyncListener;
        }
 internal ServerManager(ConnectionInfo info, IConnectionListener listener, IServerListener asyncListener)
 {
     Stream stream = null;
     this.probeTimeoutMillis = info.probeTimeoutMillis;
     this.probeWarningMillis = info.probeWarningMillis;
     this.reconnectionTimeoutMillis = info.reconnectionTimeoutMillis;
     this.localPushServerProxy = new PushServerProxy(info);
     try
     {
         stream = this.localPushServerProxy.ConnectForSession();
         try
         {
             listener.OnConnectionEstablished();
         }
         catch (Exception)
         {
         }
         this.localPushServerProxy.StartSession(stream);
         try
         {
             listener.OnSessionStarted();
         }
         catch (Exception)
         {
         }
     }
     catch (PhaseException)
     {
     }
     this.serverListener = asyncListener;
 }
Beispiel #4
0
 internal ServerManager(ConnectionInfo info, IServerListener asyncListener)
 {
     this.connInfo = info;
     this.localPushServerProxy = new PushServerProxy(info);
     this.activityController = new ActivityController(this);
     this.mexParallelizer = new MessageParallelizer(this.mexBatchMonitor, this);
     this.serverListener = asyncListener;
 }
 internal virtual void CallDestroyRequest(PushServerProxy.PushServerProxyInfo pushInfo)
 {
     IDictionary parameters = new Dictionary<string, string>();
     parameters["LS_session"] = pushInfo.sessionId;
     parameters["LS_op"] = "destroy";
     string controlUrl = pushInfo.controlAddress + "/lightstreamer/control.txt";
     StreamReader notBatchedAnswer = this.batchManager.GetNotBatchedAnswer(controlUrl, parameters);
     try
     {
         this.CheckAnswer(notBatchedAnswer);
     }
     finally
     {
         try
         {
             streamLogger.Debug("Closing destroy connection");
             notBatchedAnswer.Close();
         }
         catch (IOException exception)
         {
             streamLogger.Debug("Error closing destroy connection", exception);
         }
     }
 }
 internal virtual void CallDelete(string userId, PushServerProxy.PushServerProxyInfo pushInfo, string[] tableCodes, BatchMonitor batch)
 {
     IDictionary parameters = new Dictionary<string, string>();
     parameters["LS_session"] = pushInfo.sessionId;
     parameters["LS_op"] = "delete";
     for (int i = 0; i < tableCodes.Length; i++)
     {
         parameters["LS_table" + (i + 1)] = tableCodes[i];
     }
     this.DoControlRequest(pushInfo, parameters, batch);
 }
 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);
         }
     }
 }
 private void DoControlRequest(PushServerProxy.PushServerProxyInfo pushInfo, IDictionary parameters, BatchMonitor batch)
 {
     string controlUrl = pushInfo.controlAddress + "/lightstreamer/control.txt";
     StreamReader answer = this.batchManager.GetAnswer(controlUrl, parameters, batch);
     try
     {
         this.CheckAnswer(answer);
     }
     catch (PushEndException)
     {
         throw new PushServerException(7);
     }
     finally
     {
         try
         {
             if (!(answer is BatchingHttpProvider.MyReader))
             {
                 streamLogger.Debug("Closing control connection");
             }
             answer.Close();
         }
         catch (IOException exception)
         {
             streamLogger.Debug("Error closing control connection", exception);
         }
     }
 }
 internal virtual void CallSendMessageRequest(PushServerProxy.PushServerProxyInfo pushInfo, string message)
 {
     IDictionary parameters = new Dictionary<string, string>();
     parameters["LS_session"] = pushInfo.sessionId;
     parameters["LS_message"] = message;
     string controlUrl = pushInfo.controlAddress + "/lightstreamer/send_message.txt";
     StreamReader notBatchedAnswer = this.batchManager.GetNotBatchedAnswer(controlUrl, parameters);
     try
     {
         this.CheckAnswer(notBatchedAnswer);
     }
     catch (PushEndException)
     {
         throw new PushServerException(7);
     }
     finally
     {
         try
         {
             streamLogger.Debug("Closing message connection");
             notBatchedAnswer.Close();
         }
         catch (IOException exception)
         {
             streamLogger.Debug("Error closing message connection", exception);
         }
     }
 }
 internal virtual void StartMessageBatch(PushServerProxy.PushServerProxyInfo pushInfo)
 {
     string controlUrl = pushInfo.controlAddress + "/lightstreamer/send_message.txt";
     this.mexBatchManager.StartBatch(controlUrl);
 }
 private void DoControlRequest(PushServerProxy.PushServerProxyInfo pushInfo, IDictionary parameters, BatchMonitor batch)
 {
     this.DoControlRequest(pushInfo, parameters, "/lightstreamer/control.txt", batch, this.batchManager);
 }
 internal virtual void CallGuaranteedSendMessageRequest(PushServerProxy.PushServerProxyInfo pushInfo, string messageProg, MessageManager message, BatchMonitor batch)
 {
     IDictionary parameters = new Dictionary<string, string>();
     parameters["LS_session"] = pushInfo.sessionId;
     parameters["LS_message"] = message.Message;
     parameters["LS_sequence"] = message.Sequence;
     parameters["LS_msg_prog"] = messageProg;
     if (message.DelayTimeout > -1)
     {
         parameters["LS_max_wait"] = Convert.ToString(message.DelayTimeout);
     }
     this.DoControlRequest(pushInfo, parameters, "/lightstreamer/send_message.txt", batch, this.mexBatchManager);
 }
Beispiel #13
0
 public AnonymousClassThread2(PushServerProxy.PushServerProxyInfo closingServerInfo, PushServerProxy enclosingInstance)
 {
     this.closingServerInfo = closingServerInfo;
     this.enclosingInstance = enclosingInstance;
 }
 public AnonymousClassThread(Stream closingLowLevelStream, StreamReader closingStream, PushServerProxy enclosingInstance)
 {
     this.closingLowLevelStream = closingLowLevelStream;
     this.closingStream         = closingStream;
     this.enclosingInstance     = enclosingInstance;
 }
 internal virtual void CallItemsRequest(PushServerProxy.PushServerProxyInfo pushInfo, string[] tableCodes, VirtualTableManager table, BatchMonitor batch)
 {
     IDictionary parameters = new Dictionary<string, string>();
     parameters["LS_session"] = pushInfo.sessionId;
     parameters["LS_op"] = "add";
     parameters["LS_mode"] = table.Mode;
     parameters["LS_schema"] = table.Schema;
     if (table.DataAdapter != null)
     {
         parameters["LS_data_adapter"] = table.DataAdapter;
     }
     for (int i = 0; i < table.NumItems; i++)
     {
         parameters["LS_table" + (i + 1)] = tableCodes[i];
         parameters["LS_id" + (i + 1)] = table.GetItemName(i);
         if (table.Selector != null)
         {
             parameters["LS_selector" + (i + 1)] = table.Selector;
         }
         if (table.Snapshot)
         {
             if (table.DistinctSnapshotLength != -1)
             {
                 parameters["LS_Snapshot" + (i + 1)] = table.DistinctSnapshotLength.ToString();
             }
             else
             {
                 parameters["LS_Snapshot" + (i + 1)] = "true";
             }
         }
         if (table.Unfiltered)
         {
             parameters["LS_requested_max_frequency" + (i + 1)] = "unfiltered";
         }
         else if (!(table.MaxFrequency == -1.0))
         {
             parameters["LS_requested_max_frequency" + (i + 1)] = table.MaxFrequency.ToString();
         }
         if (table.MaxBufferSize != -1)
         {
             parameters["LS_requested_buffer_size" + (i + 1)] = table.MaxBufferSize.ToString();
         }
     }
     this.DoControlRequest(pushInfo, parameters, batch);
 }
 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);
 }
 public AnonymousClassThread(Stream closingLowLevelStream, StreamReader closingStream, PushServerProxy enclosingInstance)
 {
     this.closingLowLevelStream = closingLowLevelStream;
     this.closingStream = closingStream;
     this.enclosingInstance = enclosingInstance;
 }
 internal virtual void CallTableRequest(PushServerProxy.PushServerProxyInfo pushInfo, string tableCode, ITableManager table, BatchMonitor batch)
 {
     IDictionary parameters = new Dictionary<string, string>();
     parameters["LS_session"] = pushInfo.sessionId;
     parameters["LS_op"] = "add";
     parameters["LS_table"] = tableCode;
     parameters["LS_id"] = table.Group;
     parameters["LS_mode"] = table.Mode;
     parameters["LS_schema"] = table.Schema;
     if (table.DataAdapter != null)
     {
         parameters["LS_data_adapter"] = table.DataAdapter;
     }
     if (table.Selector != null)
     {
         parameters["LS_selector"] = table.Selector;
     }
     if (table.Snapshot)
     {
         if (table.DistinctSnapshotLength != -1)
         {
             parameters["LS_Snapshot"] = table.DistinctSnapshotLength.ToString();
         }
         else
         {
             parameters["LS_Snapshot"] = "true";
         }
     }
     if (table.Start != -1)
     {
         parameters["LS_start"] = table.Start.ToString();
     }
     if (table.End != -1)
     {
         parameters["LS_end"] = table.End.ToString();
     }
     if (table.Unfiltered)
     {
         parameters["LS_requested_max_frequency"] = "unfiltered";
     }
     else if (!(table.MaxFrequency == -1.0))
     {
         parameters["LS_requested_max_frequency"] = table.MaxFrequency.ToString();
     }
     if (table.MaxBufferSize != -1)
     {
         parameters["LS_requested_buffer_size"] = table.MaxBufferSize.ToString();
     }
     this.DoControlRequest(pushInfo, parameters, batch);
 }
 internal virtual void CallDelete(string userId, PushServerProxy.PushServerProxyInfo pushInfo, string[] winCodes, BatchMonitor batch)
 {
     Hashtable parameters = new Hashtable();
     parameters["LS_session"] = pushInfo.sessionId;
     parameters["LS_op"] = "delete";
     for (int i = 0; i < winCodes.Length; i++)
     {
         parameters["LS_window" + (i + 1)] = winCodes[i];
     }
     this.DoControlRequest(pushInfo, parameters, batch);
 }
 internal virtual void StartControlBatch(PushServerProxy.PushServerProxyInfo pushInfo)
 {
     string controlUrl = pushInfo.controlAddress + "/lightstreamer/control.txt";
     this.batchManager.StartBatch(controlUrl);
 }
 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);
 }