MultiThreadDownloader icon indicating copy to clipboard operation
MultiThreadDownloader copied to clipboard

刚点击开始下载,马上dlStop,就会onError: 101 XXXX is downloading.

Open 0xm1nam0 opened this issue 9 years ago • 2 comments

刚点击开始下载,马上dlStop,再点击开始就会一直onError: 101 XXXX is downloading.,无论是取消下载还是会onError: 101 XXXX is downloading

0xm1nam0 avatar Apr 21 '16 01:04 0xm1nam0

应该是概率性会出现一直onError: 101 XXXX is downloading,感觉是网络弱的时候会,很久都不关闭线程,无论我在onError: 101的时候调用dlStop,还是没效果

0xm1nam0 avatar Apr 21 '16 03:04 0xm1nam0

这样就解决了

/** * 根据Url暂停一个下载任务 * Stop a download task according to url. * * @param url 文件下载地址 * Download url. */ public void dlPause(String url) { if (TASK_DLING.containsKey(url)) { DLInfo info = TASK_DLING.get(url); info.isStop = true; if (!info.threads.isEmpty()) { for (DLThreadInfo threadInfo : info.threads) { threadInfo.isStop = true; } } } if (TASK_DLING != null) { TASK_DLING.remove(url); } }

Alex-Cin avatar Aug 23 '16 16:08 Alex-Cin