Skip to content
This repository has been archived by the owner on Feb 7, 2021. It is now read-only.

Commit

Permalink
fix bug of info lost after system shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
anatasluo committed Apr 11, 2019
1 parent 1d06cb9 commit 3e17a6c
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 75 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ chrome-profiler-events.json
speed-measure-plugin.json

# IDEs and editors
/.idea
/.idea/*
/backend/.idea/*
.directory
.project
.classpath
.c9/
Expand Down
150 changes: 81 additions & 69 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ If you like this application, please consider give a star for this project.

## TODO List
- Add support for network speed limit
- Add support for maximum number of download task

## Architecture:
![](./src/assets/READEME/architecture.jpg)
Expand All @@ -46,8 +47,6 @@ If you like this application, please consider give a star for this project.
![](./src/assets/READEME/steaming.png)
--------------

## Download Mirror

## Get Started

You can download packaged binary file directly from [Release](https://github.com/anatasluo/ant/releases)
Expand Down
1 change: 1 addition & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

## TODO List
- Add support for network speed limit
- Add support for maximum number of download task

## 项目架构:
![](./src/assets/READEME/architecture.jpg)
Expand Down
4 changes: 2 additions & 2 deletions backend/engine/engineTorrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ func (engine *Engine)AddOneTorrentFromMagnet (linkAddress string)(tmpTorrent *to
}else{
logger.Debug("Add torrent from magnet")
engine.EngineRunningInfo.UpdateMagnetInfo(tmpTorrent)
engine.SaveInfo()
engine.GenerateInfoFromTorrent(tmpTorrent)
engine.SaveInfo()
engine.StartDownloadTorrent(tmpTorrent.InfoHash().HexString())
engine.EngineRunningInfo.EngineCMD <- RefreshInfo
logger.Debug("It should refresh")
Expand Down Expand Up @@ -128,7 +128,6 @@ func (engine *Engine)StartDownloadTorrent(hexString string)(downloaded bool) {
singleTorrentLog, _ := engine.EngineRunningInfo.HashToTorrentLog[singleTorrent.InfoHash()]
if singleTorrentLog.Status != RunningStatus {
singleTorrentLog.Status = RunningStatus
engine.SaveInfo()
//check if extend exist
_, extendIsExist := engine.EngineRunningInfo.TorrentLogExtends[singleTorrent.InfoHash()];
if !extendIsExist {
Expand Down Expand Up @@ -200,6 +199,7 @@ func (engine *Engine)StopOneTorrent(hexString string)(stopped bool) {
singleTorrentLog, _:= engine.EngineRunningInfo.HashToTorrentLog[singleTorrent.InfoHash()]
if singleTorrentLog.Status != CompletedStatus {
singleTorrentLog.Status = StoppedStatus
engine.SaveInfo()
//engine.EngineRunningInfo.UpdateTorrentLog()
singleTorrentLogExtend, extendExist := engine.EngineRunningInfo.TorrentLogExtends[singleTorrent.InfoHash()]
if extendExist && singleTorrentLogExtend.HasStatusPub && singleTorrentLogExtend.StatusPub != nil {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ant-downloader",
"version": "1.2.0",
"version": "1.2.1",
"description": "",
"homepage": "https://github.com/anatasluo/ant",
"repository": {
Expand Down

0 comments on commit 3e17a6c

Please sign in to comment.