From adbd0b1834861d84552fb3f2843c9fb559f268a5 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Thu, 15 May 2014 00:29:18 -0300 Subject: [PATCH] Rename mc -> beacon --- {mc => beacon}/beacon.go | 4 ++-- {mc => beacon}/cmd/mctest/main.go | 0 {mc => beacon}/debug.go | 4 ++-- discover/discover.go | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) rename {mc => beacon}/beacon.go (97%) rename {mc => beacon}/cmd/mctest/main.go (100%) rename {mc => beacon}/debug.go (50%) diff --git a/mc/beacon.go b/beacon/beacon.go similarity index 97% rename from mc/beacon.go rename to beacon/beacon.go index e45568e22..e8ab78bdd 100644 --- a/mc/beacon.go +++ b/beacon/beacon.go @@ -1,4 +1,4 @@ -package mc +package beacon import "net" @@ -20,7 +20,7 @@ type Beacon struct { outbox chan recv } -func NewBeacon(port int) (*Beacon, error) { +func New(port int) (*Beacon, error) { conn, err := net.ListenUDP("udp", &net.UDPAddr{Port: port}) if err != nil { return nil, err diff --git a/mc/cmd/mctest/main.go b/beacon/cmd/mctest/main.go similarity index 100% rename from mc/cmd/mctest/main.go rename to beacon/cmd/mctest/main.go diff --git a/mc/debug.go b/beacon/debug.go similarity index 50% rename from mc/debug.go rename to beacon/debug.go index 6e8573ba1..07c7c4be6 100644 --- a/mc/debug.go +++ b/beacon/debug.go @@ -1,4 +1,4 @@ -package mc +package beacon import ( "os" @@ -8,6 +8,6 @@ import ( ) var ( - debug = strings.Contains(os.Getenv("STTRACE"), "mc") || os.Getenv("STTRACE") == "all" + debug = strings.Contains(os.Getenv("STTRACE"), "beacon") || os.Getenv("STTRACE") == "all" l = logger.DefaultLogger ) diff --git a/discover/discover.go b/discover/discover.go index 8d579cf44..8b677a025 100644 --- a/discover/discover.go +++ b/discover/discover.go @@ -9,8 +9,8 @@ import ( "sync" "time" + "github.com/calmh/syncthing/beacon" "github.com/calmh/syncthing/buffers" - "github.com/calmh/syncthing/mc" ) const ( @@ -22,7 +22,7 @@ type Discoverer struct { listenAddrs []string localBcastIntv time.Duration globalBcastIntv time.Duration - beacon *mc.Beacon + beacon *beacon.Beacon registry map[string][]string registryLock sync.RWMutex extServer string @@ -43,7 +43,7 @@ var ( const maxErrors = 30 func NewDiscoverer(id string, addresses []string) (*Discoverer, error) { - b, err := mc.NewBeacon(21025) + b, err := beacon.New(21025) if err != nil { return nil, err }