*** empty log message ***

This commit is contained in:
Arvid Norberg 2005-03-05 14:17:17 +00:00
parent 999754ee23
commit a5c91f683a
6 changed files with 34 additions and 8 deletions

View File

@ -2205,6 +2205,16 @@ blocks specified by <tt class="docutils literal"><span class="pre">bitmask</span
</table>
</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">file</span> <span class="pre">sizes</span></tt></td>
<td>list where each entry corresponds to a file in the file list
in the metadata. Each entry has a list of two values, the
first value is the size of the file in bytes, the second
is the timestamp when the last time someone wrote to it.
This information is used to compare with the files on disk.
All the files must match exactly this information in order
to consider the resume data as current. Otherwise a full
re-check is issued.</td>
</tr>
</tbody>
</table>
</div>

View File

@ -115,7 +115,7 @@ namespace libtorrent
// loop in session_impl will check for this state
// on all torrents once every second, and take
// the necessary actions then.
void abort() { m_abort = true; m_event = tracker_request::stopped; }
void abort();
bool is_aborted() const { return m_abort; }
// is called every second by session. This will
@ -379,7 +379,7 @@ namespace libtorrent
// blocks when requested
int m_block_size;
// if this pointer is 0, the peer_connection is in
// if this pointer is 0, the torrent is in
// a state where the metadata hasn't been
// received yet.
std::auto_ptr<piece_manager> m_storage;

View File

@ -1310,10 +1310,13 @@ namespace libtorrent
void peer_connection::disconnect()
{
if (m_disconnecting) return;
detail::session_impl::connection_map::iterator i = m_ses.m_connections.find(m_socket);
detail::session_impl::connection_map::iterator i
= m_ses.m_connections.find(m_socket);
m_disconnecting = true;
assert(i != m_ses.m_connections.end());
assert(std::find(m_ses.m_disconnect_peer.begin(), m_ses.m_disconnect_peer.end(), i) == m_ses.m_disconnect_peer.end());
assert(std::find(m_ses.m_disconnect_peer.begin()
, m_ses.m_disconnect_peer.end(), i)
== m_ses.m_disconnect_peer.end());
m_ses.m_disconnect_peer.push_back(i);
}
@ -1849,6 +1852,7 @@ namespace libtorrent
{
INVARIANT_CHECK;
assert(!m_disconnecting);
assert(!m_socket->is_blocking());
assert(m_packet_size > 0);
assert(m_socket->is_readable());
@ -2158,6 +2162,7 @@ namespace libtorrent
{
INVARIANT_CHECK;
assert(!m_disconnecting);
assert(m_socket->is_writable());
assert(can_write());

View File

@ -404,6 +404,7 @@ namespace libtorrent { namespace detail
#ifndef NDEBUG
check_invariant("before abort");
#endif
purge_connections();
if (m_abort)
{
@ -690,8 +691,6 @@ namespace libtorrent { namespace detail
req.listen_port = m_listen_interface.port;
req.key = m_key;
m_tracker_manager.queue_request(req, t.tracker_login());
t.disconnect_all();
purge_connections();
#ifndef NDEBUG
sha1_hash i_hash = t.torrent_file().info_hash();
#endif

View File

@ -187,7 +187,7 @@ namespace libtorrent
size = file_size(f);
time = last_write_time(f);
}
catch (file_error&) {}
catch (std::exception&) {}
sizes.push_back(std::make_pair(size, time));
}
return sizes;
@ -215,7 +215,7 @@ namespace libtorrent
size = file_size(f);
time = last_write_time(f);
}
catch (file_error&) {}
catch (std::exception&) {}
if (size != s->first || time != s->second)
return false;
}

View File

@ -493,6 +493,15 @@ namespace libtorrent
assert(m_have_pieces[index] == false);
}
void torrent::abort()
{
m_abort = true;
m_event = tracker_request::stopped;
// disconnect all peers and close all
// files belonging to the torrent
disconnect_all();
m_storage.release();
}
void torrent::announce_piece(int index)
{
@ -829,6 +838,9 @@ namespace libtorrent
// tell the tracker that we stopped
m_event = tracker_request::stopped;
m_just_paused = true;
// this will make the storage close all
// files and flush all cached data
if (m_storage.get()) m_storage->release();
}
void torrent::resume()