Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Cai <jcai@gitlab.com>2023-08-22 20:33:31 +0300
committerJohn Cai <jcai@gitlab.com>2023-08-22 20:33:31 +0300
commitcd40480a3e12cb1c9c49349237afa25fb2153ffb (patch)
tree29e686df60098237acff46344fac4480db5b0395
parentcc214cd7a519cd09c8befa45cf2f4e957562b906 (diff)
debugging purposesjc/test-data-transfer-bytes
-rw-r--r--internal/gitaly/service/ssh/upload_pack.go1
-rw-r--r--internal/helper/count.go11
2 files changed, 11 insertions, 1 deletions
diff --git a/internal/gitaly/service/ssh/upload_pack.go b/internal/gitaly/service/ssh/upload_pack.go
index ec1656566..c11fb7b3c 100644
--- a/internal/gitaly/service/ssh/upload_pack.go
+++ b/internal/gitaly/service/ssh/upload_pack.go
@@ -181,6 +181,7 @@ func (s *server) sshUploadPack(rpcContext context.Context, req sshUploadPackRequ
ctxlogrus.Extract(ctx).WithField("response_bytes", stdoutCounter.N).Info("request details")
+ fmt.Println(stdoutCounter.String())
return nil, stdoutCounter.N, 0, nil
}
diff --git a/internal/helper/count.go b/internal/helper/count.go
index c5b7c419b..77f1c94c9 100644
--- a/internal/helper/count.go
+++ b/internal/helper/count.go
@@ -1,16 +1,25 @@
package helper
-import "io"
+import (
+ "bytes"
+ "io"
+)
// CountingWriter wraps an io.Writer and counts all the writes. Accessing
// the count N is not thread-safe.
type CountingWriter struct {
W io.Writer
N int64
+ b bytes.Buffer
}
func (cw *CountingWriter) Write(p []byte) (int, error) {
n, err := cw.W.Write(p)
cw.N += int64(n)
+ cw.b.Write(p)
return n, err
}
+
+func (cw *CountingWriter) String() string {
+ return cw.b.String()
+}