From daba249249bae6990156ad48e76d6e6c4a6014c6 Mon Sep 17 00:00:00 2001 From: Qiu Jian Date: Thu, 17 Jan 2019 00:08:57 +0800 Subject: [PATCH] minor updates --- cmd/torrent/main.go | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index 9cb5bc4b5f..e573be3056 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -146,26 +146,19 @@ func main() { log.Fatalf("%s", err) } - go func() { - <-t.GotInfo() + <-t.GotInfo() + t.DownloadAll() - files := t.Info().Files - log.Debugf("Got Info, start download %d files", len(files)) - for i := 0; i < len(files); i += 1 { - log.Debugf("%d: %s", i, files[i].Path) - } - - t.DownloadAll() - }() + stop := false go func() { <-client.Closed() log.Debugf("client closed, exit!") - os.Exit(0) + stop = true }() - for { + for !stop { if t.BytesCompleted() == t.Info().TotalLength() { fmt.Printf("\rSeeding.............") if len(options.CallbackURL) > 0 {