// Token: 0x0600053D RID: 1341 RVA: 0x00018114 File Offset: 0x00016314 public void Close(int statusCode, string reason) { this.m_ClosedArgs = new ClosedEventArgs((short)statusCode, reason); if (Interlocked.CompareExchange(ref this.m_StateCode, 3, -1) == -1) { this.OnClosed(); return; } if (Interlocked.CompareExchange(ref this.m_StateCode, 2, 0) != 0) { this.m_StateCode = 2; this.ClearTimer(); this.m_WebSocketTimer = new Timer(new TimerCallback(this.CheckCloseHandshake), null, 5000, -1); try { this.ProtocolProcessor.SendCloseHandshake(this, statusCode, reason); } catch (Exception e) { if (this.Client != null) { this.OnError(e); } } return; } TcpClientSession client = this.Client; if (client != null && client.IsConnected) { client.Close(); return; } this.OnClosed(); }
protected virtual void Dispose(bool disposing) { if (m_Disposed) { return; } if (disposing) { TcpClientSession client = Client; if (client != null) { client.Connected -= client_Connected; client.Closed -= client_Closed; client.Error -= client_Error; client.DataReceived -= client_DataReceived; if (client.IsConnected) { client.Close(); } Client = null; } ClearTimer(); } m_Disposed = true; }
protected virtual void Dispose(bool disposing) { if (this.m_disposed) { return; } if (disposing) { TcpClientSession client = this.Client; if (client != null) { client.Connected -= new EventHandler(this.client_Connected); client.Closed -= new EventHandler(this.client_Closed); client.Error -= new EventHandler <ErrorEventArgs>(this.client_Error); client.DataReceived -= new EventHandler <DataEventArgs>(this.client_DataReceived); if (client.IsConnected) { client.Close(); } this.Client = (TcpClientSession)null; } if (this.m_WebSocketTimer != null) { this.m_WebSocketTimer.Dispose(); } } this.m_disposed = true; }
public void Close(int statusCode, string reason) { this.m_ClosedArgs = new ClosedEventArgs((short)statusCode, reason); if (Interlocked.CompareExchange(ref this.m_StateCode, 3, -1) == -1) { this.OnClosed(); } else if (Interlocked.CompareExchange(ref this.m_StateCode, 2, 0) == 0) { TcpClientSession client = this.Client; if (client != null && client.IsConnected) { client.Close(); } else { this.OnClosed(); } } else { this.m_StateCode = 2; this.ClearTimer(); this.m_WebSocketTimer = new Timer(new TimerCallback(this.CheckCloseHandshake), (object)null, 5000, -1); this.ProtocolProcessor.SendCloseHandshake(this, statusCode, reason); } }
// Token: 0x0600053F RID: 1343 RVA: 0x00018210 File Offset: 0x00016410 public void CloseWithoutHandshake() { TcpClientSession client = this.Client; if (client != null) { client.Close(); } }
protected override void OnSessionClosed(CloseReason reason) { if (m_BufferSegment.Array != null) { AppServer.PushProxyBuffer(m_BufferSegment); } if (m_TargetSession != null) { m_TargetSession.Close(); } }
public void Close(int statusCode, string reason) { m_ClosedArgs = new ClosedEventArgs((short)statusCode, reason); if (Interlocked.CompareExchange(ref m_StateCode, 3, -1) == -1) { OnClosed(); } else if (Interlocked.CompareExchange(ref m_StateCode, 2, 0) == 0) { TcpClientSession client = Client; if (client != null && client.IsConnected) { client.Close(); } else { OnClosed(); } } else { m_StateCode = 2; ClearTimer(); m_WebSocketTimer = new Timer(CheckCloseHandshake, null, 5000, -1); try { ProtocolProcessor.SendCloseHandshake(this, statusCode, reason); } catch (Exception e) { if (Client != null) { OnError(e); } } } }