refactor: move ConnectionMaker and related types

This commit is contained in:
Matthias Radestock committed 2014-12-24 19:46:12 +00:00
1 parent 03b338a252
commit 71cd83bf20
2 files changed
+19 -19

No files matched your search

+19
View File
@@ -21,6 +21,25 @@ const (
CMStatus = iota
)
type ConnectionMaker struct {
router *Router
targets map[string]*Target
cmdLineAddress map[string]bool
queryChan chan<- *ConnectionMakerInteraction
}
// Information about an address where we may find a peer
type Target struct {
attempting bool // are we currently attempting to connect there?
tryAfter time.Time // next time to try this address
tryInterval time.Duration // backoff time on next failure
}
type ConnectionMakerInteraction struct {
Interaction
address string
}
func StartConnectionMaker(router *Router) *ConnectionMaker {
queryChan := make(chan *ConnectionMakerInteraction, ChannelSize)
state := &ConnectionMaker{
-19
View File
@@ -150,25 +150,6 @@ type Interaction struct {
resultChan chan<- interface{}
}
type ConnectionMakerInteraction struct {
Interaction
address string
}
type ConnectionMaker struct {
router *Router
queryChan chan<- *ConnectionMakerInteraction
targets map[string]*Target
cmdLineAddress map[string]bool
}
// Information about an address where we may find a peer
type Target struct {
attempting bool // are we currently attempting to connect there?
tryAfter time.Time // next time to try this address
tryInterval time.Duration // backoff time on next failure
}
// UDPSender interface and implementations
type UDPSender interface {