]> Cypherpunks repositories - gostls13.git/commit
net: check /etc/hosts for modifications every 5 seconds, not 5 minutes
authorRuss Cox <rsc@golang.org>
Tue, 5 Jan 2016 02:04:01 +0000 (21:04 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 6 Jan 2016 21:42:19 +0000 (21:42 +0000)
commitb598a7fc5d167fe5be137d2c5cc9f1f6a01636ef
tree485b9ac499fdaa49d3503162dd310bfc6e4a9c14
parentfb394017f1b5081f1243688c0686ba5faca96835
net: check /etc/hosts for modifications every 5 seconds, not 5 minutes

But also cache the previous parsed form and don't reread if the
size and modification time are both unchanged from before.

On systems with stable /etc/hosts this should result in more stat calls
but only a single parsing of /etc/hosts.

On systems with variable /etc/hosts files (like some Docker systems)
this should result in quicker adoption of changes.

Fixes #13340.

Change-Id: Iba93b204be73d6d903cd17c58038a4fcfd0952b9
Reviewed-on: https://go-review.googlesource.com/18258
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/hosts.go
src/net/parse.go