torrent_client 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/ext/torrent_client/torrent_client.cc +13 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77f3beb70a73972a925aaaa1b84fc400eb3e44df
|
4
|
+
data.tar.gz: 59b3fedbedbda0d258776a3108e89e1e8da0c208
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 558e6b34501da7960c0982816c2d72c687d006508134ec2a18ca7badda3ae0a2404a45e312a2dafe78455d141f78d6694fc0d56f9976b18dbaa454952533690b
|
7
|
+
data.tar.gz: b1d8a7d96f6860d5e24a4373d28a2abf0e11944ac91b28a18afe016a06bdffcabc6733085023c1ea45f12b5369837f577c7e09fda85856cc991d596d415a66d2
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.2.1] - 2016-04-06
|
4
|
+
|
5
|
+
Fixes TorrentClient.verify, which wasn't returning false when the file was
|
6
|
+
corrupted. Also should be more robust to halting on errors.
|
7
|
+
|
3
8
|
## [0.2.0] - 2016-04-06
|
4
9
|
|
5
10
|
Adds TorrentClient.verify, moves libtorrent session creation to happen once when
|
@@ -53,7 +53,7 @@ extern "C" {
|
|
53
53
|
return Qnil;
|
54
54
|
}
|
55
55
|
|
56
|
-
while (
|
56
|
+
while (handle.is_valid()) {
|
57
57
|
if (_session->wait_for_alert(lt::seconds(1))) {
|
58
58
|
std::auto_ptr<lt::alert> a = _session->pop_alert();
|
59
59
|
if (a->type() == lt::torrent_finished_alert::alert_type) {
|
@@ -75,7 +75,6 @@ extern "C" {
|
|
75
75
|
lt::error_code ec;
|
76
76
|
lt::add_torrent_params p;
|
77
77
|
p.save_path = StringValueCStr(destination_dir);
|
78
|
-
p.flags = lt::add_torrent_params::flag_paused;
|
79
78
|
p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
|
80
79
|
if (ec) {
|
81
80
|
rb_raise(rb_eRuntimeError, ec.message().c_str());
|
@@ -88,21 +87,22 @@ extern "C" {
|
|
88
87
|
return Qnil;
|
89
88
|
}
|
90
89
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
_session->wait_for_alert(lt::seconds(1))
|
95
|
-
|
90
|
+
bool success = false;
|
91
|
+
bool running = true;
|
92
|
+
while (handle.is_valid()) {
|
93
|
+
if (_session->wait_for_alert(lt::seconds(1))) {
|
94
|
+
std::auto_ptr<lt::alert> a = _session->pop_alert();
|
95
|
+
if (a->type() == lt::torrent_checked_alert::alert_type) {
|
96
|
+
handle.pause();
|
97
|
+
success = handle.status(0).is_finished;
|
98
|
+
break;
|
99
|
+
}
|
100
|
+
}
|
96
101
|
}
|
97
102
|
|
98
103
|
_session->remove_torrent(handle);
|
99
104
|
|
100
|
-
|
101
|
-
status.state == lt::torrent_status::queued_for_checking) {
|
102
|
-
return Qtrue;
|
103
|
-
} else {
|
104
|
-
return Qfalse;
|
105
|
-
}
|
105
|
+
return success ? Qtrue : Qfalse;
|
106
106
|
} catch (std::exception &e) {
|
107
107
|
rb_raise(rb_eRuntimeError, "failed from unknown exception");
|
108
108
|
}
|