Skip to content

Commit 0e06df7

Browse files
author
xuleiming
committed
fix "bfe_http : readloop goroutine leak #1209"
Signed-off-by: xuleiming <xuleiming@yf-networks.com>
1 parent 84df246 commit 0e06df7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bfe_http/transport.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,10 @@ func (pc *persistConn) readLoop() {
885885
err = ReadRespHeaderError{Err: err}
886886
}
887887

888+
pc.lk.Lock()
889+
pc.numExpectedResponses--
890+
pc.lk.Unlock()
891+
888892
rc.ch <- responseAndError{resp, err}
889893

890894
// Wait for the just-returned response body to be fully consumed
@@ -1051,10 +1055,6 @@ WaitResponse:
10511055
}
10521056
}
10531057

1054-
pc.lk.Lock()
1055-
pc.numExpectedResponses--
1056-
pc.lk.Unlock()
1057-
10581058
if re.err != nil {
10591059
pc.t.setReqConn(req.Request, nil)
10601060
}

0 commit comments

Comments
 (0)