aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-10-12 21:55:18 +0100
committerGitHub <noreply@github.com>2021-10-12 21:55:18 +0100
commit429258cff3f5ff6ef94ae33c587f2d899c40b4c1 (patch)
tree9926a243494ef0313fddee98017be99597859e3b
parent7bcbdd07072d375eb9f24a64a047879ae2aa7aed (diff)
downloadgitea-429258cff3f5ff6ef94ae33c587f2d899c40b4c1.tar.gz
gitea-429258cff3f5ff6ef94ae33c587f2d899c40b4c1.zip
Use pointer for wrappedConn methods (#17295)
Fix #17294 Signed-off-by: Andrew Thornton <art27@cantab.net>
-rw-r--r--modules/graceful/server.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/graceful/server.go b/modules/graceful/server.go
index 23eb821c8c..f7ec791d85 100644
--- a/modules/graceful/server.go
+++ b/modules/graceful/server.go
@@ -228,7 +228,7 @@ func (wl *wrappedListener) Accept() (net.Conn, error) {
closed := int32(0)
- c = wrappedConn{
+ c = &wrappedConn{
Conn: c,
server: wl.server,
closed: &closed,
@@ -263,7 +263,7 @@ type wrappedConn struct {
perWritePerKbTimeout time.Duration
}
-func (w wrappedConn) Write(p []byte) (n int, err error) {
+func (w *wrappedConn) Write(p []byte) (n int, err error) {
if w.perWriteTimeout > 0 {
minTimeout := time.Duration(len(p)/1024) * w.perWritePerKbTimeout
minDeadline := time.Now().Add(minTimeout).Add(w.perWriteTimeout)
@@ -277,7 +277,7 @@ func (w wrappedConn) Write(p []byte) (n int, err error) {
return w.Conn.Write(p)
}
-func (w wrappedConn) Close() error {
+func (w *wrappedConn) Close() error {
if atomic.CompareAndSwapInt32(w.closed, 0, 1) {
defer func() {
if err := recover(); err != nil {