public void SendCB(int status) { _sending = false; _ostream.CleanUp(); OnWriteEvent?.Invoke(this, status); while (_pending.Count > 0) { var p = _pending.Peek(); if (GetFullPacketSize(p) > _ostream.EmptyLength) { break; } if (p.seqId == 0) { _ostream.WriteInt32(p.len); _ostream.WriteRawByte(p.body, 0, p.len); } else { int len = p.len + OutputStream.GetSize(p.seqId); _ostream.WriteInt32(len); _ostream.WriteUInt32(p.seqId); _ostream.WriteRawByte(p.body, 0, p.len); } _pending.Dequeue(); } DoSend(); }
/* * protected override void Dispose(bool disposing) * { * base.Dispose(disposing); * } */ void OnWriteCallback(int status) { OnWriteEvent?.Invoke(status); Dispose(); }