private static bool PumpData(TlsProtocol from, TlsProtocol to, bool fragment) { int byteCount = from.GetAvailableOutputBytes(); if (byteCount == 0) { return(false); } if (fragment) { byte[] buffer = new byte[1]; while (from.GetAvailableOutputBytes() > 0) { from.ReadOutput(buffer, 0, 1); to.OfferInput(buffer); } } else { byte[] buffer = new byte[byteCount]; from.ReadOutput(buffer, 0, buffer.Length); to.OfferInput(buffer); } return(true); }
private static bool PumpData(TlsProtocol from, TlsProtocol to, bool fragment) { int byteCount = from.GetAvailableOutputBytes(); if (byteCount == 0) { return false; } if (fragment) { while (from.GetAvailableOutputBytes() > 0) { byte[] buffer = new byte[1]; from.ReadOutput(buffer, 0, 1); to.OfferInput(buffer); } } else { byte[] buffer = new byte[byteCount]; from.ReadOutput(buffer, 0, buffer.Length); to.OfferInput(buffer); } return true; }