From 71cd83bf2036297d2530838fdad7f62402b8f555 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Wed, 24 Dec 2014 19:46:12 +0000 Subject: [PATCH] refactor: move ConnectionMaker and related types --- router/connection_maker.go | 19 +++++++++++++++++++ router/types.go | 19 ------------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/router/connection_maker.go b/router/connection_maker.go index cf951565..ae15ea25 100644 --- a/router/connection_maker.go +++ b/router/connection_maker.go @@ -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{ diff --git a/router/types.go b/router/types.go index 8c29d53a..ba3ceb81 100644 --- a/router/types.go +++ b/router/types.go @@ -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 {