public ChannelWindow <T> CreateWindow(int windowSize) { windowSize = this.RequestWindowSize(windowSize); ChannelWindow <T> window = new ChannelWindow <T>(this, windowSize); if (windowSize > this.MaximumWindowSize) { this.MaximumWindowSize = windowSize; } this.windows.Add(new WeakReference(window, true)); return(window); }
internal void DestroyWindow(ChannelWindow <T> window) { WeakReference r = null; int max = 1; foreach (WeakReference i in this.windows) { if (i.Target == window) { r = i; } else { max = Math.Max(max, ((ChannelWindow <T>)i.Target).WindowSize); } } if (r != null) { this.MaximumWindowSize = max; this.windows.Remove(r); } }