mirror of
https://github.com/sot-tech/mochi.git
synced 2026-07-28 10:08:11 -07:00
tracker: Add common interface to start and stop servers
This commit is contained in:
@@ -24,6 +24,15 @@ type Tracker struct {
|
||||
*Storage
|
||||
}
|
||||
|
||||
// Server represents a server for a given BitTorrent tracker protocol.
|
||||
type Server interface {
|
||||
// Serve runs the server and blocks until the server has shut down.
|
||||
Serve()
|
||||
|
||||
// Stop cleanly shuts down the server in a non-blocking manner.
|
||||
Stop()
|
||||
}
|
||||
|
||||
// New creates a new Tracker, and opens any necessary connections.
|
||||
// Maintenance routines are automatically spawned in the background.
|
||||
func New(cfg *config.Config) (*Tracker, error) {
|
||||
|
||||
Reference in New Issue
Block a user