Silence "golint" errors

Silence "go vet" errors
Run goimports
This commit is contained in:
Alvaro Saurin committed 2015-05-28 10:05:22 +02:00
1 parent 40d7b2a87d
commit 6d2317d60e
21 files changed
+126 -106

No files matched your search

+3 -2
View File
@@ -1,10 +1,11 @@
package nameserver
import (
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
"net"
"testing"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
)
func TestAddrs(t *testing.T) {
+4 -3
View File
@@ -5,12 +5,13 @@ import (
"container/heap"
"errors"
"fmt"
"github.com/benbjohnson/clock"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
"math"
"sync"
"time"
"github.com/benbjohnson/clock"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
)
var (
+5 -4
View File
@@ -2,13 +2,14 @@ package nameserver
import (
"fmt"
"net"
"testing"
"time"
"github.com/benbjohnson/clock"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
"net"
"testing"
"time"
)
// Check that the cache keeps its intended capacity constant
@@ -201,7 +202,7 @@ func TestCacheEntries(t *testing.T) {
wt.AssertNotNil(t, err, "Get() error with CacheNoLocalReplies")
clk.Add(time.Second * time.Duration(negLocalTTL+1))
t.Logf("Checking that we get an expired response after %f seconds", negLocalTTL)
t.Logf("Checking that we get an expired response after %d seconds", negLocalTTL)
resp, err = l.Get(questionMsg3, minUDPSize)
wt.AssertNil(t, resp, "expired Get() response with CacheNoLocalReplies")
wt.AssertNil(t, err, "expired Get() error with CacheNoLocalReplies")
+2 -1
View File
@@ -1,9 +1,10 @@
package nameserver
import (
"github.com/miekg/dns"
"math/rand"
"time"
"github.com/miekg/dns"
)
const (
+3 -2
View File
@@ -1,11 +1,12 @@
package nameserver
import (
"net"
"testing"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
"net"
"testing"
)
// Check that we can prune an answer
+4 -3
View File
@@ -2,12 +2,13 @@ package nameserver
import (
"fmt"
"github.com/gorilla/mux"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
"log"
"net"
"net/http"
"github.com/gorilla/mux"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
)
func httpErrorAndLog(level *log.Logger, w http.ResponseWriter, msg string,
+2 -1
View File
@@ -2,7 +2,6 @@ package nameserver
import (
"fmt"
wt "github.com/weaveworks/weave/testing"
"math/rand"
"net"
"net/http"
@@ -10,6 +9,8 @@ import (
"strings"
"testing"
"time"
wt "github.com/weaveworks/weave/testing"
)
func genForm(method string, url string, data url.Values) (resp *http.Response, err error) {
+2 -1
View File
@@ -3,10 +3,11 @@ package nameserver
import (
"bytes"
"fmt"
"github.com/miekg/dns"
"math"
"net"
"time"
"github.com/miekg/dns"
)
// Portions of this code taken from github.com/armon/mdns
+4 -3
View File
@@ -1,13 +1,14 @@
package nameserver
import (
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
"log"
"net"
"testing"
"time"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
)
var (
+2 -1
View File
@@ -1,9 +1,10 @@
package nameserver
import (
"net"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
"net"
)
type MDNSServer struct {
+4 -3
View File
@@ -1,12 +1,13 @@
package nameserver
import (
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
"net"
"testing"
"time"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
)
func TestServerSimpleQuery(t *testing.T) {
+4 -3
View File
@@ -1,12 +1,13 @@
package nameserver
import (
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
"net"
"testing"
"time"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
)
// Check that we can use a regular mDNS server with a regular mDNS client
+15 -14
View File
@@ -2,15 +2,16 @@ package nameserver
import (
"fmt"
"github.com/benbjohnson/clock"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
"net"
"strconv"
"sync"
"testing"
"time"
"github.com/benbjohnson/clock"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
)
const (
@@ -153,7 +154,7 @@ func (mc *mockedMDNSClient) LookupName(name string) ([]ZoneRecord, error) {
defer mc.Unlock()
// get a random result
mc.NumLookupsName += 1
mc.NumLookupsName++
for _, server := range mc.servers {
r, err := server.Zone().LookupName(name)
if err == nil {
@@ -168,7 +169,7 @@ func (mc *mockedMDNSClient) LookupInaddr(inaddr string) ([]ZoneRecord, error) {
defer mc.Unlock()
// get a random result
mc.NumLookupsInaddr += 1
mc.NumLookupsInaddr++
for _, server := range mc.servers {
r, err := server.Zone().LookupInaddr(inaddr)
if err == nil {
@@ -182,8 +183,8 @@ func (mc *mockedMDNSClient) InsistentLookupName(name string) ([]ZoneRecord, erro
mc.Lock()
defer mc.Unlock()
res := make([]ZoneRecord, 0)
mc.NumInsLookupsName += 1
var res []ZoneRecord
mc.NumInsLookupsName++
for _, server := range mc.servers {
r, err := server.Zone().LookupName(name)
if err == nil {
@@ -200,8 +201,8 @@ func (mc *mockedMDNSClient) InsistentLookupInaddr(inaddr string) ([]ZoneRecord,
mc.Lock()
defer mc.Unlock()
res := make([]ZoneRecord, 0)
mc.NumInsLookupsInaddr += 1
var res []ZoneRecord
mc.NumInsLookupsInaddr++
for _, server := range mc.servers {
r, err := server.Zone().LookupInaddr(inaddr)
if err == nil {
@@ -231,7 +232,7 @@ func (mc *mockedMDNSClient) RemoveServer(srv ZoneMDNSServer) {
type zbmEntry struct {
Server *mockedMDNSServer
Client *mockedMDNSClient
Zone *zoneDb
Zone *ZoneDb
}
type zoneDbsWithMockedMDns []*zbmEntry
@@ -303,14 +304,14 @@ type mockedCache struct {
func newMockedCache() *mockedCache { return &mockedCache{} }
func (c *mockedCache) Get(request *dns.Msg, maxLen int) (reply *dns.Msg, err error) {
c.NumGets += 1
c.NumGets++
return nil, nil
}
func (c *mockedCache) Put(request *dns.Msg, reply *dns.Msg, ttl int, flags uint8) int {
c.NumPuts += 1
c.NumPuts++
return 0
}
func (c *mockedCache) Remove(question *dns.Question) { c.NumRemovals += 1 }
func (c *mockedCache) Remove(question *dns.Question) { c.NumRemovals++ }
func (c *mockedCache) Purge() {}
func (c *mockedCache) Clear() {}
func (c *mockedCache) Len() int { return 0 }
+4 -3
View File
@@ -3,13 +3,14 @@ package nameserver
import (
"bytes"
"fmt"
"github.com/benbjohnson/clock"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
"net"
"strconv"
"sync"
"time"
"github.com/benbjohnson/clock"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
)
const (
+4 -3
View File
@@ -2,12 +2,13 @@ package nameserver
import (
"fmt"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
"net"
"testing"
"time"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
)
// Check if the names updates lead to cache invalidations
+5 -4
View File
@@ -3,12 +3,13 @@ package nameserver
import (
"encoding/binary"
"fmt"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
"net"
"testing"
"time"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
)
const (
@@ -180,7 +181,7 @@ func TestTCPDNSServer(t *testing.T) {
fallback.Start()
defer fallback.Stop()
t.Logf("Creating a WeaveDNS server instance, falling back to 127.0.0.1:%s", fallback.Port)
t.Logf("Creating a WeaveDNS server instance, falling back to 127.0.0.1:%d", fallback.Port)
srv, err := NewDNSServer(DNSServerConfig{
Zone: zone,
UpstreamCfg: fallback.CliConfig,
+38 -37
View File
@@ -3,12 +3,13 @@ package nameserver
import (
"bytes"
"fmt"
"github.com/benbjohnson/clock"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
"net"
"sync"
"time"
"github.com/benbjohnson/clock"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
)
const (
@@ -103,8 +104,8 @@ func newRecordEntry(zr ZoneRecord, now time.Time) *recordEntry {
}
}
func (i *recordEntry) addIPObserver(zro ZoneRecordObserver) {
i.observers = append(i.observers, zro)
func (re *recordEntry) addIPObserver(zro ZoneRecordObserver) {
re.observers = append(re.observers, zro)
}
// Notify all the IP observers and then remove them all
@@ -280,24 +281,24 @@ func newNamesSet() *namesSet { return &namesSet{names: make(map[string]*name
func (ns *namesSet) len() int { return len(ns.names) }
func (ns *namesSet) empty() bool { return ns.len() == 0 }
func (ns *namesSet) hasName(name string) bool {
if n, found := ns.names[name]; !found {
n, found := ns.names[name]
if !found {
return false
} else {
// the name must have some valid IPs in order to be considered as "existent"
return len(n.ipv4) > 0
}
// the name must have some valid IPs in order to be considered as "existent"
return len(n.ipv4) > 0
}
// Get the zone entries for a name
// If the name does not exist and `create` is true, a new name will be created
func (ns *namesSet) getName(name string, create bool) (n *name) {
if n, found := ns.names[name]; !found && create {
n, found := ns.names[name]
if !found && create {
newName := newName(name)
ns.names[name] = newName
return newName
} else {
return n
}
return n
}
// Get all the entries for a name
@@ -333,16 +334,16 @@ func (ns *namesSet) addIPToName(zr ZoneRecord, now time.Time) (*recordEntry, err
// Delete a name in the names set
func (ns *namesSet) deleteName(n string) error {
if name, found := ns.names[n]; found {
name, found := ns.names[n]
if found {
for _, ipRecord := range name.getAllEntries() {
ipRecord.notifyIPObservers()
}
name.notifyNameObservers()
delete(ns.names, n)
return nil
} else {
return LookupError(fmt.Sprintf("%+v", name))
}
return LookupError(fmt.Sprintf("%+v", name))
}
// Delete an IPv4 from all names
@@ -441,7 +442,7 @@ type ZoneConfig struct {
// The zone database contains the locally known information about the zone.
// The zone database uses some other mechanisms (eg, mDNS) for finding unknown
// information or for keeping current information up to date.
type zoneDb struct {
type ZoneDb struct {
mx sync.RWMutex
idents identRecordsSet
@@ -461,13 +462,13 @@ type zoneDb struct {
}
// Create a new zone database
func NewZoneDb(config ZoneConfig) (zone *zoneDb, err error) {
func NewZoneDb(config ZoneConfig) (zone *ZoneDb, err error) {
maxRefreshRequests := defaultRefreshMailbox
if config.MaxRefreshRequests > 0 {
maxRefreshRequests = config.MaxRefreshRequests
}
zone = &zoneDb{
zone = &ZoneDb{
domain: config.Domain,
idents: make(identRecordsSet),
mdnsCli: config.MDNSClient,
@@ -514,7 +515,7 @@ func NewZoneDb(config ZoneConfig) (zone *zoneDb, err error) {
}
// Start the zone database
func (zone *zoneDb) Start() (err error) {
func (zone *ZoneDb) Start() (err error) {
if zone.iface != nil {
Info.Printf("[zonedb] Using mDNS on %+v", zone.iface)
} else {
@@ -548,7 +549,7 @@ func (zone *zoneDb) Start() (err error) {
}
// Perform a graceful shutdown of the zone database
func (zone *zoneDb) Stop() error {
func (zone *ZoneDb) Stop() error {
if zone.refreshInterval > 0 {
Debug.Printf("[zonedb] Closing background updaters...")
close(zone.refreshCloseChan)
@@ -562,12 +563,12 @@ func (zone *zoneDb) Stop() error {
}
// Obtain the domain where this database keeps information for
func (zone *zoneDb) Domain() string {
func (zone *ZoneDb) Domain() string {
return zone.domain
}
// Return the status string
func (zone *zoneDb) Status() string {
func (zone *ZoneDb) Status() string {
var buf bytes.Buffer
fmt.Fprintln(&buf, "Local domain", zone.domain)
fmt.Fprintln(&buf, "Interface", zone.iface)
@@ -576,7 +577,7 @@ func (zone *zoneDb) Status() string {
}
// Add a record with `name` pointing to `ip`
func (zone *zoneDb) AddRecord(ident string, name string, ip net.IP) (err error) {
func (zone *ZoneDb) AddRecord(ident string, name string, ip net.IP) (err error) {
zone.mx.Lock()
defer zone.mx.Unlock()
Debug.Printf("[zonedb] Adding record: '%s'/'%s'[%s]", ident, name, ip)
@@ -586,7 +587,7 @@ func (zone *zoneDb) AddRecord(ident string, name string, ip net.IP) (err error)
}
// Delete all records for an ident
func (zone *zoneDb) DeleteRecordsFor(ident string) (err error) {
func (zone *ZoneDb) DeleteRecordsFor(ident string) (err error) {
zone.mx.Lock()
defer zone.mx.Unlock()
Debug.Printf("[zonedb] Deleting records for ident '%s'", ident)
@@ -595,7 +596,7 @@ func (zone *zoneDb) DeleteRecordsFor(ident string) (err error) {
}
// Delete an IP in a ident
func (zone *zoneDb) DeleteRecord(ident string, ip net.IP) (err error) {
func (zone *ZoneDb) DeleteRecord(ident string, ip net.IP) (err error) {
zone.mx.Lock()
defer zone.mx.Unlock()
@@ -620,7 +621,7 @@ func (zone *zoneDb) DeleteRecord(ident string, ip net.IP) (err error) {
// The observer will be invoked on any change/removal that affects this name.
// Each observer will be invoked at least once (but possibly more). After that, they will be removed.
// The observer should not try to lock the ZoneDB (you will get a deadlock)
func (zone *zoneDb) ObserveName(name string, observer ZoneRecordObserver) (err error) {
func (zone *ZoneDb) ObserveName(name string, observer ZoneRecordObserver) (err error) {
zone.mx.Lock()
defer zone.mx.Unlock()
@@ -629,7 +630,7 @@ func (zone *zoneDb) ObserveName(name string, observer ZoneRecordObserver) (err e
for _, nameset := range zone.idents {
if n := nameset.getName(name, false); n != nil {
n.addNameObserver(observer)
cnt += 1
cnt++
}
}
if cnt == 0 {
@@ -646,7 +647,7 @@ func (zone *zoneDb) ObserveName(name string, observer ZoneRecordObserver) (err e
// The observer will be invoked on any change/removal that affects this IP.
// Each observer will be invoked at least once (but possibly more). After that, they will be removed.
// The observer should not try to lock the ZoneDB (you will get a deadlock)
func (zone *zoneDb) ObserveInaddr(inaddr string, observer ZoneRecordObserver) (err error) {
func (zone *ZoneDb) ObserveInaddr(inaddr string, observer ZoneRecordObserver) (err error) {
zone.mx.Lock()
defer zone.mx.Unlock()
@@ -658,7 +659,7 @@ func (zone *zoneDb) ObserveInaddr(inaddr string, observer ZoneRecordObserver) (e
for _, nameset := range zone.idents {
for _, entry := range nameset.getEntriesForIP(revIP) {
entry.addIPObserver(observer)
cnt += 1
cnt++
}
}
if cnt == 0 {
@@ -668,20 +669,20 @@ func (zone *zoneDb) ObserveInaddr(inaddr string, observer ZoneRecordObserver) (e
}
// Get the string representation of a zone
func (zone *zoneDb) String() string {
func (zone *ZoneDb) String() string {
zone.mx.RLock()
defer zone.mx.RUnlock()
return zone.idents.String()
}
// Notify that a container has died
func (zone *zoneDb) ContainerDied(ident string) error {
func (zone *ZoneDb) ContainerDied(ident string) error {
Info.Printf("[zonedb] Container %s down. Removing records", ident)
return zone.DeleteRecordsFor(ident)
}
// Return true if a remote name is still relevant
func (zone *zoneDb) IsNameRelevant(n string) bool {
func (zone *ZoneDb) IsNameRelevant(n string) bool {
zone.mx.Lock()
defer zone.mx.Unlock()
@@ -699,7 +700,7 @@ func (zone *zoneDb) IsNameRelevant(n string) bool {
// Returns true if the info we have for a remote name has expired. Local names are never expired
// Returns false if we do not have info for this name from remote peers.
func (zone *zoneDb) IsNameExpired(n string) bool {
func (zone *ZoneDb) IsNameExpired(n string) bool {
zone.mx.Lock()
defer zone.mx.Unlock()
@@ -716,7 +717,7 @@ func (zone *zoneDb) IsNameExpired(n string) bool {
return false
}
func (zone *zoneDb) HasNameLocalInfo(n string) bool {
func (zone *ZoneDb) HasNameLocalInfo(n string) bool {
zone.mx.Lock()
defer zone.mx.Unlock()
@@ -734,7 +735,7 @@ func (zone *zoneDb) HasNameLocalInfo(n string) bool {
// Return true if the we have obtained some information for a name from remote peers
// We can have both local (eg, introduced through the HTTP API) and remote (eg, mDNS)
// information for a name. This method only checks if there is remote information...
func (zone *zoneDb) HasNameRemoteInfo(n string) bool {
func (zone *ZoneDb) HasNameRemoteInfo(n string) bool {
zone.mx.Lock()
defer zone.mx.Unlock()
@@ -746,7 +747,7 @@ func (zone *zoneDb) HasNameRemoteInfo(n string) bool {
}
// Get or create a names set
func (zone *zoneDb) getNamesSet(ident string) *namesSet {
func (zone *ZoneDb) getNamesSet(ident string) *namesSet {
ns, found := zone.idents[ident]
if !found {
ns = newNamesSet()
@@ -756,7 +757,7 @@ func (zone *zoneDb) getNamesSet(ident string) *namesSet {
}
// Delete a ident
func (zone *zoneDb) deleteIdent(ident string) {
func (zone *ZoneDb) deleteIdent(ident string) {
Info.Printf("[zonedb] Removing everything for ident '%s'", ident)
if ns, found := zone.idents[ident]; found {
for _, n := range ns.names {
+12 -12
View File
@@ -1,9 +1,10 @@
package nameserver
import (
"time"
"github.com/miekg/dns"
. "github.com/weaveworks/weave/common"
"time"
)
type uniqZoneRecordKey struct {
@@ -38,7 +39,7 @@ func (uzr *uniqZoneRecords) toSlice() []ZoneRecord {
//////////////////////////////////////////////////////////////////////////////
// Lookup in the database for locally-introduced information
func (zone *zoneDb) lookup(target string, lfun func(ns *namesSet) []*recordEntry) (res []ZoneRecord, err error) {
func (zone *ZoneDb) lookup(target string, lfun func(ns *namesSet) []*recordEntry) (res []ZoneRecord, err error) {
uniq := newUniqZoneRecords()
for identName, nameset := range zone.idents {
if identName != defaultRemoteIdent {
@@ -49,14 +50,13 @@ func (zone *zoneDb) lookup(target string, lfun func(ns *namesSet) []*recordEntry
}
if len(uniq) == 0 {
return nil, LookupError(target)
} else {
return uniq.toSlice(), nil
}
return uniq.toSlice(), nil
}
// Perform a lookup for a name in the zone
// The name can be resolved locally with the local database
func (zone *zoneDb) LookupName(name string) (res []ZoneRecord, err error) {
func (zone *ZoneDb) LookupName(name string) (res []ZoneRecord, err error) {
zone.mx.RLock()
defer zone.mx.RUnlock()
@@ -68,7 +68,7 @@ func (zone *zoneDb) LookupName(name string) (res []ZoneRecord, err error) {
// Perform a lookup for a IP address in the zone
// The address can be resolved locally with the local database
func (zone *zoneDb) LookupInaddr(inaddr string) (res []ZoneRecord, err error) {
func (zone *ZoneDb) LookupInaddr(inaddr string) (res []ZoneRecord, err error) {
zone.mx.RLock()
defer zone.mx.RUnlock()
@@ -82,7 +82,7 @@ func (zone *zoneDb) LookupInaddr(inaddr string) (res []ZoneRecord, err error) {
}
// Perform a domain lookup with mDNS
func (zone *zoneDb) domainLookup(target string, lfun ZoneLookupFunc) (res []ZoneRecord, err error) {
func (zone *ZoneDb) domainLookup(target string, lfun ZoneLookupFunc) (res []ZoneRecord, err error) {
// no local results have been obtained in the local database: try with a mDNS query
Debug.Printf("[zonedb] '%s' not in local database... trying with mDNS", target)
lanswers, err := lfun(target)
@@ -115,7 +115,7 @@ func (zone *zoneDb) domainLookup(target string, lfun ZoneLookupFunc) (res []Zone
// Perform a lookup for a name in the zone
// The name can be resolved locally with the local database or with some other resolution method (eg, a mDNS query)
func (zone *zoneDb) DomainLookupName(name string) (res []ZoneRecord, err error) {
func (zone *ZoneDb) DomainLookupName(name string) (res []ZoneRecord, err error) {
name = dns.Fqdn(name)
Debug.Printf("[zonedb] Looking for name '%s' in local(&remote) database", name)
@@ -156,7 +156,7 @@ func (zone *zoneDb) DomainLookupName(name string) (res []ZoneRecord, err error)
// Perform a lookup for a IP address in the zone
// The address can be resolved either with the local database or
// with some other resolution method (eg, a mDNS query)
func (zone *zoneDb) DomainLookupInaddr(inaddr string) (res []ZoneRecord, err error) {
func (zone *ZoneDb) DomainLookupInaddr(inaddr string) (res []ZoneRecord, err error) {
revIPv4, err := raddrToIPv4(inaddr)
if err != nil {
return nil, newParseError("lookup address", inaddr)
@@ -239,7 +239,7 @@ func (zone *zoneDb) DomainLookupInaddr(inaddr string) (res []ZoneRecord, err err
// Anyway, maybe we will move to a gossip-based solution instead of doing this polling...
// Check if we must start updating a name and, in that case, trigger a immediate update
func (zone *zoneDb) startUpdatingName(name string) {
func (zone *ZoneDb) startUpdatingName(name string) {
if zone.refreshInterval > 0 {
zone.mx.Lock()
defer zone.mx.Unlock()
@@ -257,7 +257,7 @@ func (zone *zoneDb) startUpdatingName(name string) {
}
// A worker for updating the list of IPs we have for a name
func (zone *zoneDb) updater(num int) {
func (zone *ZoneDb) updater(num int) {
defer zone.refreshWg.Done()
Debug.Printf("[zonedb] Starting background updater #%d...", num)
@@ -310,7 +310,7 @@ func (zone *zoneDb) updater(num int) {
// The periodic updater
// Consume requests from the `refreshSchedChan`, where requests with increasing scheduling time are enqueued
// for refreshing names...
func (zone *zoneDb) periodicUpdater() {
func (zone *ZoneDb) periodicUpdater() {
defer zone.refreshWg.Done()
for {
select {
+3 -2
View File
@@ -1,11 +1,12 @@
package nameserver
import (
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
"net"
"testing"
"time"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
)
// Check that the refreshing mechanism works as expected
+3 -2
View File
@@ -2,10 +2,11 @@ package nameserver
import (
"fmt"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
"net"
"testing"
. "github.com/weaveworks/weave/common"
wt "github.com/weaveworks/weave/testing"
)
func TestZone(t *testing.T) {
+3 -2
View File
@@ -3,12 +3,13 @@ package main
import (
"flag"
"fmt"
"net"
"os"
. "github.com/weaveworks/weave/common"
"github.com/weaveworks/weave/common/updater"
weavedns "github.com/weaveworks/weave/nameserver"
weavenet "github.com/weaveworks/weave/net"
"net"
"os"
)
var version = "(unreleased version)"