diff --git a/docs/manual.html b/docs/manual.html index 7054120d2..884003d21 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -3100,7 +3100,7 @@ the entire file.

closing down.

Example code to pause and save resume data for all torrents and wait for the alerts:

-int num_resume_data = 0;
+extern int outstanding_resume_data; // global counter of outstanding resume data
 std::vector<torrent_handle> handles = ses.get_torrents();
 ses.pause();
 for (std::vector<torrent_handle>::iterator i = handles.begin();
@@ -3110,12 +3110,13 @@ for (std::vector<torrent_handle>::iterator i = handles.begin();
         if (!h.is_valid()) continue;
         torrent_status s = h.status();
         if (!s.has_metadata) continue;
+        if (!s.need_save_resume_data()) continue;
 
         h.save_resume_data();
-        ++num_resume_data;
+        ++outstanding_resume_data;
 }
 
-while (num_resume_data > 0)
+while (outstanding_resume_data > 0)
 {
         alert const* a = ses.wait_for_alert(seconds(10));
 
@@ -3127,7 +3128,7 @@ while (num_resume_data > 0)
         if (alert_cast<save_resume_data_failed_alert>(a))
         {
                 process_alert(a);
-                --num_resume_data;
+                --outstanding_resume_data;
                 continue;
         }
 
@@ -3143,9 +3144,18 @@ while (num_resume_data > 0)
                 / (h.get_torrent_info().name() + ".fastresume"), std::ios_base::binary);
         out.unsetf(std::ios_base::skipws);
         bencode(std::ostream_iterator<char>(out), *rd->resume_data);
-        --num_resume_data;
+        --outstanding_resume_data;
 }
 
+
+

Note

+

Note how outstanding_resume_data is a global counter in this example. +This is deliberate, otherwise there is a race condition for torrents that +was just asked to save their resume data, they posted the alert, but it has +not been received yet. Those torrents would report that they don't need to +save resume data again, and skipped by the initial loop, and thwart the counter +otherwise.

+

need_save_resume_data()

@@ -3158,6 +3168,12 @@ bool need_save_resume_data() const; torrent was first loaded or since the last time the resume data was saved. When saving resume data periodically, it makes sense to skip any torrent which hasn't downloaded anything since the last time.

+
+

Note

+

A torrent's resume data is considered saved as soon as the alert +is posted. It is important to make sure this alert is received and handled +in order for this function to be meaningful.

+

status()

@@ -6303,7 +6319,7 @@ struct peer_disconnected_alert: peer_alert

invalid_request_alert

This is a debug alert that is generated by an incoming invalid piece request. -ìp is the address of the peer and the request is the actual incoming +Ïp is the address of the peer and the request is the actual incoming request from the peer.

 struct invalid_request_alert: peer_alert
@@ -7754,13 +7770,13 @@ std::string error_code_to_string(boost::system::error_code const& ec)
         static const char const* swedish[] =
         {
                 "inget fel",
-                "en fil i torrenten kolliderar med en fil från en annan torrent",
+                "en fil i torrenten kolliderar med en fil frÂn en annan torrent",
                 "hash check misslyckades",
-                "torrent filen är inte en dictionary",
-                "'info'-nyckeln saknas eller är korrupt i torrentfilen",
-                "'info'-fältet är inte en dictionary",
-                "'piece length' fältet saknas eller är korrupt i torrentfilen",
-                "torrentfilen saknar namnfältet",
+                "torrent filen ‰r inte en dictionary",
+                "'info'-nyckeln saknas eller ‰r korrupt i torrentfilen",
+                "'info'-f‰ltet ‰r inte en dictionary",
+                "'piece length' f‰ltet saknas eller ‰r korrupt i torrentfilen",
+                "torrentfilen saknar namnf‰ltet",
                 "ogiltigt namn i torrentfilen (kan vara en attack)",
                 // ... more strings here
         };