void disposeInternal(bool disposeBrother) { if (!mDisposed) { try { mInnerChannel.Close(); } catch (Exception ex) { Debug.Fail($"InnerChannel close catch an exception: {ex.ToString()}"); } if (mBrotherTunnel != null && disposeBrother) { mBrotherTunnel.disposeInternal(false); } mInnerChannel = null; mSelector = null; mBrotherTunnel = null; mDisposed = true; sessionCount--; onDispose(); NatSessionManager.removeSession(portKey); } }
public void setBrotherTunnel(TcpTunnel brotherTunnel) { mBrotherTunnel = brotherTunnel; }