diff options
Diffstat (limited to 'network/protocol/v0v1/server')
| -rw-r--r-- | network/protocol/v0v1/server/receivepack/session.go | 3 | ||||
| -rw-r--r-- | network/protocol/v0v1/server/session.go | 24 |
2 files changed, 5 insertions, 22 deletions
diff --git a/network/protocol/v0v1/server/receivepack/session.go b/network/protocol/v0v1/server/receivepack/session.go index d7b2a7c5..b4902df4 100644 --- a/network/protocol/v0v1/server/receivepack/session.go +++ b/network/protocol/v0v1/server/receivepack/session.go @@ -2,7 +2,6 @@ package receivepack import ( "fmt" - "io" "strings" "codeberg.org/lindenii/furgit/common/iowrap" @@ -181,7 +180,7 @@ func (session *Session) WriteError(p []byte) error { // 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 { +func (session *Session) ErrorWriter() iowrap.WriteFlusher { return session.base.ErrorWriter() } diff --git a/network/protocol/v0v1/server/session.go b/network/protocol/v0v1/server/session.go index 45e14c92..23818014 100644 --- a/network/protocol/v0v1/server/session.go +++ b/network/protocol/v0v1/server/session.go @@ -97,19 +97,6 @@ func (session *Session) Flush() error { return session.enc.Flush() } -type flushWriter struct { - writer io.Writer - flush func() error -} - -func (w flushWriter) Write(p []byte) (int, error) { - return w.writer.Write(p) -} - -func (w flushWriter) Flush() error { - return w.flush() -} - // ProgressWriter returns one chunking writer for sideband progress output. // // When side-band-64k was not negotiated, writes are discarded. @@ -118,18 +105,15 @@ func (session *Session) ProgressWriter() iowrap.WriteFlusher { return iowrap.NopFlush(io.Discard) } - return flushWriter{ - writer: sideband64k.NewChunkWriter(session.sideband, sideband64k.BandProgress), - flush: session.sideband.Flush, - } + 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 { +func (session *Session) ErrorWriter() iowrap.WriteFlusher { if !session.useSideBand { - return io.Discard + return iowrap.NopFlush(io.Discard) } return sideband64k.NewChunkWriter(session.sideband, sideband64k.BandError) @@ -139,7 +123,7 @@ func (session *Session) ErrorWriter() io.Writer { // // When side-band-64k is enabled, writes are chunked into band-1 sideband // frames. Otherwise writes are chunked into direct pkt-line data frames. -func (session *Session) PrimaryDataWriter() io.Writer { +func (session *Session) PrimaryDataWriter() iowrap.WriteFlusher { if session.useSideBand { return sideband64k.NewChunkWriter(session.sideband, sideband64k.BandData) } |
