I read golang's source code recently, and find a place that doesn't make 
sence.

```

if t.MaxIdleConns != 0 && t.idleLRU.len() > t.MaxIdleConns { 

      oldest := t.idleLRU.removeOldest() 

      oldest.close(errTooManyIdle) 

      t.removeIdleConnLocked(oldest) 

}

```

the code is here : 
https://github.com/golang/go/blob/96c8cc7fea94dca8c9e23d9653157e960f2ff472/src/net/http/transport.go#L984-L988

question: 

when idleConn's length > t.MaxIdleConns, why not close the conn directly 
instead of putting the conn into a new list. and remove the oldest conn in 
the list. As I understand it, it's simple to close the redundant 
connection, and it turns out to be corrent.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/df4dfe5d-63cc-4770-baf9-ba28fc025df1n%40googlegroups.com.

Reply via email to