internal virtual void close() { if (connectedChannel != null) { connectedChannel.Close(); } else if (datagramChannel != null) { datagramChannel.Close(); } else { ssl.Close(); readingQueue.Close(); writingQueue.Close(); try { socketReader.Join(); socketWriter.Join(); } catch (System.Exception) { // ignore } } }
/// <summary> /// 销毁游戏资源 /// </summary> public void Dispose() { if (!mDisposed) { mDisposed = true; if (null != In) { In.Close(); In = null; } if (null != Out) { Out.Close(); Out = null; } if (null != Buffer) { Buffer.Close(); Buffer.Dispose(); Buffer = null; } } }