Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseLeecher ¶
type BaseLeecher struct {
Peers map[string]struct{}
Quit chan struct{}
Wg sync.WaitGroup
Mu *sync.RWMutex
Terminated bool
// contains filtered or unexported fields
}
BaseLeecher is a generic items downloader
func New ¶
func New(recheckInterval time.Duration, callback Callbacks) *BaseLeecher
New creates a generic items downloader
func (*BaseLeecher) PeersNum ¶
func (d *BaseLeecher) PeersNum() int
func (*BaseLeecher) RegisterPeer ¶
func (d *BaseLeecher) RegisterPeer(peer string) error
RegisterPeer injects a new download peer to download items from.
func (*BaseLeecher) Routine ¶
func (d *BaseLeecher) Routine()
func (*BaseLeecher) Start ¶
func (d *BaseLeecher) Start()
func (*BaseLeecher) Stop ¶
func (d *BaseLeecher) Stop()
Stop interrupts the leecher, canceling all the pending operations. Stop waits until all the internal goroutines have finished.
func (*BaseLeecher) Terminate ¶
func (d *BaseLeecher) Terminate()
func (*BaseLeecher) UnregisterPeer ¶
func (d *BaseLeecher) UnregisterPeer(peer string) error
UnregisterPeer removes a peer from the known list, preventing current or any future sessions with the peer
Click to show internal directories.
Click to hide internal directories.