Commit 339dafdc authored by Petar Radovic's avatar Petar Radovic

hive peer suggester, saturation tracker

parent 2b6cbf1b
...@@ -20,8 +20,10 @@ const ( ...@@ -20,8 +20,10 @@ const (
) )
type Service struct { type Service struct {
streamer p2p.Streamer streamer p2p.Streamer
logger logging.Logger logger logging.Logger
peerSuggester PeerSuggester
saturationTracker SaturationTracker
tickInterval time.Duration tickInterval time.Duration
done chan struct{} done chan struct{}
...@@ -29,9 +31,11 @@ type Service struct { ...@@ -29,9 +31,11 @@ type Service struct {
} }
type Options struct { type Options struct {
Streamer p2p.Streamer Streamer p2p.Streamer
Logger logging.Logger Logger logging.Logger
TickInterval time.Duration PeerSuggester PeerSuggester
SaturationTracker SaturationTracker
TickInterval time.Duration
} }
// PeerSuggester suggests a peer to connect to // PeerSuggester suggests a peer to connect to
...@@ -46,10 +50,12 @@ type SaturationTracker interface { ...@@ -46,10 +50,12 @@ type SaturationTracker interface {
func New(o Options) *Service { func New(o Options) *Service {
return &Service{ return &Service{
streamer: o.Streamer, streamer: o.Streamer,
logger: o.Logger, logger: o.Logger,
tickInterval: o.TickInterval, tickInterval: o.TickInterval,
done: make(chan struct{}), peerSuggester: o.PeerSuggester,
saturationTracker: o.SaturationTracker,
done: make(chan struct{}),
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment