Skip to content

Commit

Permalink
Use pointer for wrappedConn methods (go-gitea#17295)
Browse files Browse the repository at this point in the history
Fix go-gitea#17294

Signed-off-by: Andrew Thornton <art27@cantab.net>
  • Loading branch information
zeripath authored and Stelios Malathouras committed Oct 15, 2021
1 parent 6acab7c commit b4fd685
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/graceful/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -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 {
Expand Down

0 comments on commit b4fd685

Please sign in to comment.