• Brad Fitzpatrick's avatar
    net: coalesce duplicate in-flight DNS lookups · 61d3b2db
    Brad Fitzpatrick authored
    In Issue 5625, Russ says: "We should at least have a cache of
    inflight lookups, so that 100 simultaneous dials of one host
    name don't do the work 100x. That's easy and (assume we forget
    the answer once they all get it) doesn't pose any consistency
    problems. It just merges simultaneous work."
    
    This brings in singleflight (unexported) from Google /
    Camlistore, but without its tests. Maybe we should put it
    somewhere in the standard library. But not now.
    
    Update #5625
    
    R=golang-dev, iant, cespare, rsc, dave, rogpeppe, remyoudompheng
    CC=golang-dev
    https://golang.org/cl/10079043
    61d3b2db
lookup.go 3.71 KB