internal MyServerListener(LSClient owner, IConnectionListener initialListener, int currPhase) { this.owner = owner; this.initialListener = initialListener; this.currPhase = currPhase; this.queue.Start(); }
public LightstreamerClient(string[] items, string[] fields) { this.items = items; this.fields = fields; client = new LSClient(); }
public StocklistClient( string pushServerUrl, DemoForm form, LightstreamerUpdateDelegate lsUpdateDelegate, LightstreamerStatusChangedDelegate lsStatusChangeDelegate) { demoForm = form; updateDelegate = lsUpdateDelegate; statusChangeDelegate = lsStatusChangeDelegate; cInfo = new ConnectionInfo(); cInfo.PushServerUrl = pushServerUrl; cInfo.Adapter = "DEMO"; client = new LSClient(); }
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); } }
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); } }
private static void AsynchCloseConnection(LSClient testClient) { new Thread(delegate { testClient.CloseConnection(); }) { IsBackground = true }.Start(); }
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); } } } }
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); } } } } }
public IGStreamingApiClient() { try { lsClient = new LSClient(); } catch (Exception) { } }
private static void AsynchCloseConnection(LSClient testClient) { var t = new Thread(() => testClient.CloseConnection()) {IsBackground = true}; t.Start(); }
internal MyServerListener(LSClient enclosingInstance, int currPhase) { this.enclosingInstance = enclosingInstance; this.currPhase = currPhase; }