forked from premiere/premiere-libtorrent
regenerated html
This commit is contained in:
parent
94b3ef81c3
commit
ea535bca2b
|
@ -3100,7 +3100,7 @@ the entire file.</p>
|
|||
closing down.</p>
|
||||
<p>Example code to pause and save resume data for all torrents and wait for the alerts:</p>
|
||||
<pre class="literal-block">
|
||||
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;
|
||||
}
|
||||
</pre>
|
||||
<div class="note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">Note how <tt class="docutils literal"><span class="pre">outstanding_resume_data</span></tt> 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.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="need-save-resume-data">
|
||||
<h2>need_save_resume_data()</h2>
|
||||
|
@ -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.</p>
|
||||
<div class="note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">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.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="id5">
|
||||
<h2>status()</h2>
|
||||
|
@ -6303,7 +6319,7 @@ struct peer_disconnected_alert: peer_alert
|
|||
<div class="section" id="invalid-request-alert">
|
||||
<h2>invalid_request_alert</h2>
|
||||
<p>This is a debug alert that is generated by an incoming invalid piece request.
|
||||
<tt class="docutils literal"><span class="pre">ìp</span></tt> is the address of the peer and the <tt class="docutils literal"><span class="pre">request</span></tt> is the actual incoming
|
||||
<tt class="docutils literal"><span class="pre">Ïp</span></tt> is the address of the peer and the <tt class="docutils literal"><span class="pre">request</span></tt> is the actual incoming
|
||||
request from the peer.</p>
|
||||
<pre class="literal-block">
|
||||
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
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue