File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ func (p *clientConnPool) closeIdleConnections() {
248
248
// break some caller's RoundTrip.
249
249
for _ , vv := range p .conns {
250
250
for _ , cc := range vv {
251
- cc .closeIfIdle ()
251
+ cc .CloseIfIdle ()
252
252
}
253
253
}
254
254
}
Original file line number Diff line number Diff line change @@ -761,14 +761,16 @@ func (cc *ClientConn) tooIdleLocked() bool {
761
761
// onIdleTimeout is called from a time.AfterFunc goroutine. It will
762
762
// only be called when we're idle, but because we're coming from a new
763
763
// goroutine, there could be a new request coming in at the same time,
764
- // so this simply calls the synchronized closeIfIdle to shut down this
765
- // connection. The timer could just call closeIfIdle , but this is more
764
+ // so this simply calls the synchronized CloseIfIdle to shut down this
765
+ // connection. The timer could just call CloseIfIdle , but this is more
766
766
// clear.
767
767
func (cc * ClientConn ) onIdleTimeout () {
768
- cc .closeIfIdle ()
768
+ cc .CloseIfIdle ()
769
769
}
770
770
771
- func (cc * ClientConn ) closeIfIdle () {
771
+ // CloseIfIdle closes the client connection if it's idle.
772
+ // exported for user-specified ClientConnPool usage.
773
+ func (cc * ClientConn ) CloseIfIdle () {
772
774
cc .mu .Lock ()
773
775
if len (cc .streams ) > 0 {
774
776
cc .mu .Unlock ()
@@ -1799,7 +1801,7 @@ func (rl *clientConnReadLoop) run() error {
1799
1801
return err
1800
1802
}
1801
1803
if rl .closeWhenIdle && gotReply && maybeIdle {
1802
- cc .closeIfIdle ()
1804
+ cc .CloseIfIdle ()
1803
1805
}
1804
1806
}
1805
1807
}
You can’t perform that action at this time.
0 commit comments