Trim dead bits of code
This commit is contained in:
parent
e586fda5f2
commit
a40217cf07
@ -11,11 +11,6 @@ type recv struct {
|
|||||||
src net.Addr
|
src net.Addr
|
||||||
}
|
}
|
||||||
|
|
||||||
type dst struct {
|
|
||||||
intf string
|
|
||||||
conn *net.UDPConn
|
|
||||||
}
|
|
||||||
|
|
||||||
type Interface interface {
|
type Interface interface {
|
||||||
Send(data []byte)
|
Send(data []byte)
|
||||||
Recv() ([]byte, net.Addr)
|
Recv() ([]byte, net.Addr)
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import "net"
|
|||||||
type Broadcast struct {
|
type Broadcast struct {
|
||||||
conn *net.UDPConn
|
conn *net.UDPConn
|
||||||
port int
|
port int
|
||||||
conns []dst
|
|
||||||
inbox chan []byte
|
inbox chan []byte
|
||||||
outbox chan recv
|
outbox chan recv
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import "net"
|
|||||||
type Multicast struct {
|
type Multicast struct {
|
||||||
conn *net.UDPConn
|
conn *net.UDPConn
|
||||||
addr *net.UDPAddr
|
addr *net.UDPAddr
|
||||||
conns []dst
|
|
||||||
inbox chan []byte
|
inbox chan []byte
|
||||||
outbox chan recv
|
outbox chan recv
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"mime"
|
"mime"
|
||||||
"net"
|
"net"
|
||||||
@ -45,7 +44,6 @@ var (
|
|||||||
configInSync = true
|
configInSync = true
|
||||||
guiErrors = []guiError{}
|
guiErrors = []guiError{}
|
||||||
guiErrorsMut sync.Mutex
|
guiErrorsMut sync.Mutex
|
||||||
static func(http.ResponseWriter, *http.Request, *log.Logger)
|
|
||||||
apiKey string
|
apiKey string
|
||||||
modt = time.Now().UTC().Format(http.TimeFormat)
|
modt = time.Now().UTC().Format(http.TimeFormat)
|
||||||
eventSub *events.BufferedSubscription
|
eventSub *events.BufferedSubscription
|
||||||
|
|||||||
@ -38,7 +38,6 @@ type Discoverer struct {
|
|||||||
forcedBcastTick chan time.Time
|
forcedBcastTick chan time.Time
|
||||||
extAnnounceOK bool
|
extAnnounceOK bool
|
||||||
extAnnounceOKmut sync.Mutex
|
extAnnounceOKmut sync.Mutex
|
||||||
globalBcastStop chan bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type cacheEntry struct {
|
type cacheEntry struct {
|
||||||
@ -50,11 +49,6 @@ var (
|
|||||||
ErrIncorrectMagic = errors.New("incorrect magic number")
|
ErrIncorrectMagic = errors.New("incorrect magic number")
|
||||||
)
|
)
|
||||||
|
|
||||||
// We tolerate a certain amount of errors because we might be running on
|
|
||||||
// laptops that sleep and wake, have intermittent network connectivity, etc.
|
|
||||||
// When we hit this many errors in succession, we stop.
|
|
||||||
const maxErrors = 30
|
|
||||||
|
|
||||||
func NewDiscoverer(id protocol.NodeID, addresses []string) *Discoverer {
|
func NewDiscoverer(id protocol.NodeID, addresses []string) *Discoverer {
|
||||||
return &Discoverer{
|
return &Discoverer{
|
||||||
myID: id,
|
myID: id,
|
||||||
|
|||||||
@ -50,12 +50,6 @@ func (s repoState) String() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Somewhat arbitrary amount of bytes that we choose to let represent the size
|
|
||||||
// of an unsynchronized directory entry or a deleted file. We need it to be
|
|
||||||
// larger than zero so that it's visible that there is some amount of bytes to
|
|
||||||
// transfer to bring the systems into synchronization.
|
|
||||||
const zeroEntrySize = 128
|
|
||||||
|
|
||||||
// How many files to send in each Index/IndexUpdate message.
|
// How many files to send in each Index/IndexUpdate message.
|
||||||
const (
|
const (
|
||||||
indexTargetSize = 250 * 1024 // Aim for making index messages no larger than 250 KiB (uncompressed)
|
indexTargetSize = 250 * 1024 // Aim for making index messages no larger than 250 KiB (uncompressed)
|
||||||
@ -89,9 +83,6 @@ type Model struct {
|
|||||||
nodeVer map[protocol.NodeID]string
|
nodeVer map[protocol.NodeID]string
|
||||||
pmut sync.RWMutex // protects protoConn and rawConn
|
pmut sync.RWMutex // protects protoConn and rawConn
|
||||||
|
|
||||||
sentLocalVer map[protocol.NodeID]map[string]uint64
|
|
||||||
slMut sync.Mutex
|
|
||||||
|
|
||||||
addedRepo bool
|
addedRepo bool
|
||||||
started bool
|
started bool
|
||||||
}
|
}
|
||||||
@ -122,7 +113,6 @@ func NewModel(indexDir string, cfg *config.Configuration, nodeName, clientName,
|
|||||||
protoConn: make(map[protocol.NodeID]protocol.Connection),
|
protoConn: make(map[protocol.NodeID]protocol.Connection),
|
||||||
rawConn: make(map[protocol.NodeID]io.Closer),
|
rawConn: make(map[protocol.NodeID]io.Closer),
|
||||||
nodeVer: make(map[protocol.NodeID]string),
|
nodeVer: make(map[protocol.NodeID]string),
|
||||||
sentLocalVer: make(map[protocol.NodeID]map[string]uint64),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, node := range cfg.Nodes {
|
for _, node := range cfg.Nodes {
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
package protocol
|
package protocol
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
@ -86,9 +85,7 @@ type rawConnection struct {
|
|||||||
state int
|
state int
|
||||||
|
|
||||||
cr *countingReader
|
cr *countingReader
|
||||||
|
|
||||||
cw *countingWriter
|
cw *countingWriter
|
||||||
wb *bufio.Writer
|
|
||||||
|
|
||||||
awaiting [4096]chan asyncResult
|
awaiting [4096]chan asyncResult
|
||||||
awaitingMut sync.Mutex
|
awaitingMut sync.Mutex
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user