aboutsummaryrefslogtreecommitdiff
path: root/protocol/v0v1
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-07 21:55:01 +0800
committerGravatar Runxi Yu2026-03-07 21:55:01 +0800
commit4c56d5a12febec96e819c7a165e5098f2c693deb (patch)
tree5cb5ca0cdc309ab37bdc9718351069c946e6e5b1 /protocol/v0v1
parentreceivepack/hooks: Add pre-defined hooks (diff)
signatureNo signature
protocol/v0v1/server: Add ProgessWriter and ErrorWriter
Diffstat (limited to 'protocol/v0v1')
-rw-r--r--protocol/v0v1/server/session.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/protocol/v0v1/server/session.go b/protocol/v0v1/server/session.go
index 98ed199c..b27ad8cd 100644
--- a/protocol/v0v1/server/session.go
+++ b/protocol/v0v1/server/session.go
@@ -86,3 +86,25 @@ func (session *Session) WriteFlush() error {
return session.enc.WriteFlush()
}
+
+// ProgressWriter returns one chunking writer for sideband progress output.
+//
+// When side-band-64k was not negotiated, writes are discarded.
+func (session *Session) ProgressWriter() io.Writer {
+ if !session.useSideBand {
+ return io.Discard
+ }
+
+ return sideband64k.NewChunkWriter(session.sideband, sideband64k.BandProgress)
+}
+
+// ErrorWriter returns one chunking writer for sideband error output.
+//
+// When side-band-64k was not negotiated, writes are discarded.
+func (session *Session) ErrorWriter() io.Writer {
+ if !session.useSideBand {
+ return io.Discard
+ }
+
+ return sideband64k.NewChunkWriter(session.sideband, sideband64k.BandError)
+}