public virtual void CloseConnection()
 {
     IConnectionListener connListener;
     ServerManager connManager;
     lock (this.connMutex)
     {
         lock (this.stateMutex)
         {
             if (this.connManager == null)
             {
                 return;
             }
             this.phase++;
             connManager = this.connManager;
             connListener = this.connListener;
         }
         this.connManager = null;
         this.connListener = null;
     }
     foreach (ITableManager manager2 in connManager.Close())
     {
         manager2.NotifyUnsub();
     }
     try
     {
         connListener.OnClose();
     }
     catch (Exception)
     {
     }
 }
Exemple #2
0
 public virtual void CloseConnection()
 {
     IConnectionListener closedListener = null;
     ServerManager connManager = null;
     MyServerListener asyncListener = null;
     LSClient subClient = null;
     lock (this.connMutex)
     {
         lock (this.stateMutex)
         {
             if (this.subClient != null)
             {
                 subClient = this.subClient;
                 this.subClient = null;
             }
             else if (this.connManager != null)
             {
                 this.phase++;
                 connManager = this.connManager;
                 closedListener = this.connListener;
                 asyncListener = this.asyncListener;
                 this.connManager = null;
                 this.connListener = null;
                 this.asyncListener = null;
             }
             else
             {
                 return;
             }
         }
     }
     if (subClient != null)
     {
         subClient.CloseConnection();
     }
     else
     {
         foreach (ITableManager manager2 in connManager.Close())
         {
             manager2.NotifyUnsub();
         }
         asyncListener.OnClosed(closedListener);
     }
 }
Exemple #3
0
 public virtual void ChangeConstraints(ConnectionConstraints constraints)
 {
     ServerManager connManager;
     try
     {
         connManager = this.ConnManager;
     }
     catch (SubscrException)
     {
         return;
     }
     try
     {
         connManager.ChangeConstraints(constraints);
     }
     catch (PhaseException)
     {
     }
 }
 internal virtual Lightstreamer.DotNet.Client.ServerUpdateEvent WaitUpdate(ServerManager.ActivityController activityController)
 {
     while (true)
     {
         this.Check();
         string pushData = this.WaitCommand(activityController);
         if (pushData != null)
         {
             Lightstreamer.DotNet.Client.ServerUpdateEvent event2;
             try
             {
                 event2 = this.serverTranslator.ParsePushData(pushData);
             }
             catch (PushServerException exception)
             {
                 throw exception;
             }
             catch (Exception exception2)
             {
                 throw new PushServerException(12, exception2);
             }
             lock (this)
             {
                 this.totalBytes += pushData.Length + 2;
             }
             this.Check();
             return event2;
         }
     }
 }
 private string WaitCommand(ServerManager.ActivityController activityController)
 {
     string str2;
     try
     {
         string str = this.serverTranslator.WaitCommand(this.pushStream);
         activityController.OnActivity();
         str2 = str;
     }
     catch (PushLengthException exception)
     {
         this.Check();
         activityController.StopKeepalives();
         throw exception;
     }
     catch (IOException exception2)
     {
         this.Check();
         throw new PushConnException(exception2);
     }
     return str2;
 }
 private string WaitCommand(ServerManager.ActivityController activityController)
 {
     StreamReader pushStream;
     string str2;
     PushServerProxy proxy;
     lock ((proxy = this))
     {
         this.Check();
         pushStream = this.pushStream;
     }
     try
     {
         string str = this.serverTranslator.WaitCommand(pushStream);
         activityController.OnActivity();
         str2 = str;
     }
     catch (PushLengthException exception)
     {
         lock ((proxy = this))
         {
             this.Check();
             this.streamCompleted = true;
         }
         activityController.StopKeepalives();
         throw exception;
     }
     catch (IOException exception2)
     {
         lock ((proxy = this))
         {
             this.Check();
             this.streamCompleted = true;
         }
         throw new PushConnException(exception2);
     }
     catch (WebException exception3)
     {
         lock ((proxy = this))
         {
             this.Check();
             this.streamCompleted = true;
         }
         throw new PushConnException(exception3);
     }
     return str2;
 }
 public AnonymousClassTimerTask2(ServerManager.ActivityController enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
 }
 public AnonymousClassTimerTask(int currPhase, ServerManager.ActivityController enclosingInstance)
 {
     this.currPhase = currPhase;
     this.enclosingInstance = enclosingInstance;
 }
Exemple #9
0
 public virtual void CloseConnection()
 {
     IConnectionListener activeListener = null;
     ServerManager closingManager = null;
     MyServerListener closeListener = null;
     LSClient closingSubClient = null;
     lock (this.stateMutex)
     {
         this.phase++;
         if (this.subClient != null)
         {
             closingSubClient = this.subClient;
             this.subClient = null;
         }
         else if (this.connManager != null)
         {
             closingManager = this.connManager;
             activeListener = this.connListener;
             closeListener = this.asyncListener;
             this.connManager = null;
             this.connListener = null;
             this.asyncListener = null;
         }
         else
         {
             return;
         }
     }
     if (closingSubClient != null)
     {
         closingSubClient.CloseConnection();
     }
     else
     {
         CloseFlushing(closingManager, closeListener, activeListener);
     }
 }
 public MessageParallelizer(BatchMonitor monitor, ServerManager manager)
 {
     this.monitor = monitor;
     monitor.Listener = this;
     this.manager = manager;
 }
 internal virtual Lightstreamer.DotNet.Client.ServerUpdateEvent WaitUpdate(ServerManager.ActivityController activityController)
 {
     while (true)
     {
         this.Check();
         InfoString pushData = this.WaitCommand(activityController);
         if (pushData != null)
         {
             Lightstreamer.DotNet.Client.ServerUpdateEvent evnt;
             if (pushData.value == null)
             {
                 return new Lightstreamer.DotNet.Client.ServerUpdateEvent(pushData.holdingMillis);
             }
             try
             {
                 evnt = this.serverTranslator.ParsePushData(pushData.value);
             }
             catch (PushServerException e)
             {
                 throw e;
             }
             catch (Exception e)
             {
                 throw new PushServerException(12, e);
             }
             lock (this)
             {
                 this.totalBytes += pushData.value.Length + 2;
             }
             this.Check();
             return evnt;
         }
     }
 }
 private InfoString WaitCommand(ServerManager.ActivityController activityController)
 {
     StreamReader currStream;
     InfoString infoString;
     PushServerProxy proxy;
     lock ((proxy = this))
     {
         this.Check();
         currStream = this.pushStream;
     }
     try
     {
         InfoString pushData = this.serverTranslator.WaitCommand(currStream);
         if ((pushData != null) && (pushData.value == null))
         {
             this.Check();
             activityController.StopKeepalives();
         }
         else
         {
             activityController.OnActivity();
         }
         infoString = pushData;
     }
     catch (PushEndException e)
     {
         lock ((proxy = this))
         {
             this.Check();
             this.streamCompleted = true;
         }
         throw e;
     }
     catch (IOException e)
     {
         lock ((proxy = this))
         {
             this.Check();
             this.streamCompleted = true;
         }
         throw new PushConnException(e);
     }
     catch (WebException e)
     {
         lock ((proxy = this))
         {
             this.Check();
             this.streamCompleted = true;
         }
         throw new PushConnException(e);
     }
     return infoString;
 }
 public virtual void OpenConnection(ConnectionInfo info, IConnectionListener listener)
 {
     lock (this.connMutex)
     {
         int num;
         object obj3;
         this.CloseConnection();
         lock ((obj3 = this.stateMutex))
         {
             num = this.phase + 1;
         }
         ServerManager.IServerListener asyncListener = new MyServerListener(this, num);
         ServerManager manager = new ServerManager(info, listener, asyncListener);
         lock ((obj3 = this.stateMutex))
         {
             this.connListener = listener;
             this.phase = num;
             this.connManager = manager;
         }
         manager.Start();
     }
 }
 internal AnonymousClassThread(ServerManager enclosingInstance, string Param1) : base(Param1)
 {
     this.enclosingInstance = enclosingInstance;
 }
 public AnonymousClassTimerTask3(bool warningOn, ServerManager.ActivityController enclosingInstance)
 {
     this.warningOn = warningOn;
     this.enclosingInstance = enclosingInstance;
 }
Exemple #16
0
 private static void CloseFlushing(ServerManager closingManager, MyServerListener closeListener, IConnectionListener activeListener)
 {
     foreach (ITableManager info in closingManager.Close())
     {
         info.NotifyUnsub();
     }
     closeListener.OnClosed(activeListener);
 }
Exemple #17
0
 public virtual void OpenConnection(ConnectionInfo info, IConnectionListener listener)
 {
     int currPhase;
     object CS$2$0000;
     lock ((CS$2$0000 = this.stateMutex))
     {
         this.CloseConnection();
         currPhase = ++this.phase;
     }
     ConnectionInfo myInfo = (ConnectionInfo) info.Clone();
     if (myInfo.EnableStreamSense && !myInfo.Polling)
     {
         LSClient testClient = new LSClient();
         ExtConnectionListener myListener = new ExtConnectionListener(listener);
         ConnectionInfo mySubInfo = (ConnectionInfo) info.Clone();
         mySubInfo.EnableStreamSense = false;
         new Thread(delegate {
             try
             {
                 testClient.OpenConnection(mySubInfo, myListener);
             }
             catch (Exception)
             {
             }
         }) { IsBackground = true }.Start();
         if (!myListener.WaitStreamingTimeoutAnswer())
         {
             lock ((CS$2$0000 = this.stateMutex))
             {
                 if (currPhase == this.phase)
                 {
                     this.subClient = testClient;
                 }
                 else
                 {
                     AsynchCloseConnection(testClient);
                     return;
                 }
             }
             myListener.FlushAndStart();
         }
         else
         {
             AsynchCloseConnection(testClient);
             lock ((CS$2$0000 = this.stateMutex))
             {
                 if (currPhase != this.phase)
                 {
                     return;
                 }
             }
             LSClient pollClient = new LSClient();
             myInfo.Polling = true;
             pollClient.OpenConnection(myInfo, listener);
             lock ((CS$2$0000 = this.stateMutex))
             {
                 if (currPhase == this.phase)
                 {
                     this.subClient = pollClient;
                 }
                 else
                 {
                     AsynchCloseConnection(pollClient);
                 }
             }
         }
     }
     else
     {
         MyServerListener serverListener = new MyServerListener(this, listener, currPhase);
         bool ok = false;
         try
         {
             ServerManager newManager = new ServerManager(myInfo, serverListener);
             newManager.Connect();
             ok = true;
             lock ((CS$2$0000 = this.stateMutex))
             {
                 if (currPhase == this.phase)
                 {
                     this.connListener = listener;
                     this.asyncListener = serverListener;
                     this.connManager = newManager;
                 }
                 else
                 {
                     CloseFlushing(newManager, serverListener, listener);
                     return;
                 }
             }
             newManager.Start();
         }
         finally
         {
             if (!ok)
             {
                 serverListener.OnClosed(null);
             }
         }
     }
 }
Exemple #18
0
 public virtual void OpenConnection(ConnectionInfo info, IConnectionListener listener)
 {
     ConnectionInfo info2 = (ConnectionInfo) info.Clone();
     info2.useGetForStreaming = true;
     lock (this.connMutex)
     {
         object obj3;
         this.CloseConnection();
         if (info2.enableStreamSense && !info2.isPolling)
         {
             ThreadStart start = null;
             LSClient testClient = new LSClient();
             ExtConnectionListener myListener = new ExtConnectionListener(listener);
             ConnectionInfo mySubInfo = (ConnectionInfo) info.Clone();
             mySubInfo.enableStreamSense = false;
             new Thread(() => {
                 try
                 {
                     testClient.OpenConnection(mySubInfo, myListener);
                 }
                 catch (Exception)
                 {
                 }
             }).Start();
             if (!myListener.WaitStreamingTimeoutAnswer())
             {
                 lock ((obj3 = this.stateMutex))
                 {
                     this.subClient = testClient;
                 }
                 myListener.FlushAndStart();
             }
             else
             {
                 if (start == null)
                 {
                     start = delegate {
                         testClient.CloseConnection();
                     };
                 }
                 new Thread(start).Start();
                 LSClient client = new LSClient();
                 info2.isPolling = true;
                 client.OpenConnection(info2, listener);
                 lock ((obj3 = this.stateMutex))
                 {
                     this.subClient = client;
                 }
             }
         }
         else
         {
             int num;
             lock ((obj3 = this.stateMutex))
             {
                 num = this.phase + 1;
             }
             MyServerListener asyncListener = new MyServerListener(this, listener, num);
             bool flag2 = false;
             try
             {
                 ServerManager manager = new ServerManager(info2, asyncListener);
                 manager.Connect();
                 lock ((obj3 = this.stateMutex))
                 {
                     this.connListener = listener;
                     this.asyncListener = asyncListener;
                     this.phase = num;
                     this.connManager = manager;
                 }
                 flag2 = true;
                 manager.Start();
             }
             finally
             {
                 if (!flag2)
                 {
                     asyncListener.OnClosed(null);
                 }
             }
         }
     }
 }
Exemple #19
0
 public ActivityController(ServerManager enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
     this.streamingConfirmed = enclosingInstance.connInfo.Polling;
 }
Exemple #20
0
 public virtual void SendMessage(string message)
 {
     ServerManager connManager;
     try
     {
         connManager = this.ConnManager;
     }
     catch (SubscrException)
     {
         return;
     }
     try
     {
         connManager.SendMessage(message);
     }
     catch (PhaseException)
     {
     }
 }
Exemple #21
0
 internal SessionActivityManager(ServerManager enclosingInstance, string Param1) : base(Param1)
 {
     this.enclosingInstance = enclosingInstance;
 }
 public ActivityController(ServerManager enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
 }