protected void SendData(NetContext context, IFrame frame) { lock (this) { ProtocolProcessor.AddFrame(context, ref dataQueue, frame); #if VERBOSE Debug.WriteLine("pushed (data): " + frame); #endif } }
protected void SendData(NetContext context, IList <IFrame> batch) { lock (this) { foreach (var frame in batch) { ProtocolProcessor.AddFrame(context, ref dataQueue, frame); #if VERBOSE Debug.WriteLine("pushed (data): " + frame); #endif } } }
protected void Push(NetContext context, WebSocketsFrame frame) { lock (this) { int maxQuota = context.Handler.MaxIncomingQuota; if (maxQuota > 0 && ProtocolProcessor.Sum(holder, f => { var typed = f as WebSocketsFrame; return(typed == null ? 0 : typed.GetLengthEstimate()); }) + frame.GetLengthEstimate() > maxQuota) { throw new InvalidOperationException("Inbound quota exceeded"); } ProtocolProcessor.AddFrame(context, ref holder, frame); } }