protected void init(Stream myStream) { stream = myStream is BufferedStream ? myStream : new BufferedStream(myStream, IndexPack.BUFFER_SIZE); pckIn = new PacketLineIn(stream); pckOut = new PacketLineOut(stream); outNeedsEnd = true; }
public RefAdvertiser(PacketLineOut o, RevWalk.RevWalk protoWalk, RevFlag advertisedFlag) { _tmpLine = new StringBuilder(100); _tmpId = new char[2 * Constants.OBJECT_ID_LENGTH]; _capabilities = new List<string>(); _first = true; _pckOut = o; _walk = protoWalk; ADVERTISED = advertisedFlag; }
public void Upload(Stream stream, Stream messages) { this.stream = stream; pckIn = new PacketLineIn(stream); pckOut = new PacketLineOut(stream); service(); }
protected void setUp() { rawOut = new MemoryStream(); pckOut = new PacketLineOut(rawOut); }
public override void Close() { if (stream != null) { try { if (outNeedsEnd) pckOut.End(); stream.Close(); } catch (IOException) { } finally { stream = null; pckOut = null; } } }
public SideBandProgressMonitor(PacketLineOut pckOut) { int bufsz = SideBandOutputStream.SMALL_BUF - SideBandOutputStream.HDR_SIZE; writer = new StreamWriter(new BufferedStream(new SideBandOutputStream(SideBandOutputStream.CH_PROGRESS, pckOut), bufsz), Constants.CHARSET); }
/// <summary> /// Execute the upload task on the socket. /// </summary> /// <param name="input"> /// raw input to read client commands from. Caller must ensure the /// input is buffered, otherwise read performance may suffer. /// </param> /// <param name="output"> /// response back to the Git network client, to write the pack /// data onto. Caller must ensure the output is buffered, /// otherwise write performance may suffer. /// </param> /// <param name="messages"> /// secondary "notice" channel to send additional messages out /// through. When run over SSH this should be tied back to the /// standard error channel of the command execution. For most /// other network connections this should be null. /// </param> /// <exception cref="IOException"></exception> public void Upload(Stream input, Stream output, Stream messages) { _rawIn = input; _rawOut = output; if (_timeout > 0) { var i = new TimeoutStream(_rawIn, _timeout * 1000); var o = new TimeoutStream(_rawOut, _timeout * 1000); _rawIn = i; _rawOut = o; } _pckIn = new PacketLineIn(_rawIn); _pckOut = new PacketLineOut(_rawOut); Service(); }
public ServiceReporter(PacketLineOut pck) { pckOut = pck; }
public void receive(Stream stream, Stream messages) { try { raw = stream; pckIn = new PacketLineIn(raw); pckOut = new PacketLineOut(raw); if (messages != null) { msgs = new StreamWriter(messages); } enabledCapabilities = new List<string>(); commands = new List<ReceiveCommand>(); service(); } finally { try { if (msgs != null) msgs.Flush(); } finally { unlockPack(); raw = null; pckIn = null; pckOut = null; msgs = null; refs = null; enabledCapabilities = null; commands = null; } } }
private void Service(string name, PacketLineOut pckOut) { var cmd = new StringBuilder(); cmd.Append(name); cmd.Append(' '); cmd.Append(Uri.Path); cmd.Append('\0'); cmd.Append("host="); cmd.Append(Uri.Host); if (Uri.Port > 0 && Uri.Port != GIT_PORT) { cmd.Append(":"); cmd.Append(Uri.Port); } cmd.Append('\0'); pckOut.WriteString(cmd.ToString()); pckOut.Flush(); }