lt sync 2969

This commit is contained in:
Andrew Resch 2008-11-22 01:00:58 +00:00
parent 16934c8f6a
commit 4bfd5646ad
10 changed files with 43 additions and 22 deletions

View file

@ -155,9 +155,9 @@ namespace libtorrent
{
for (directory_iterator i(f), end; i != end; ++i)
#if BOOST_VERSION < 103600
add_files_impl(fs, p, l / i->leaf(), pred);
add_files_impl(fs, p, l / i->path().leaf(), pred);
#else
add_files_impl(fs, p, l / i->filename(), pred);
add_files_impl(fs, p, l / i->path().filename(), pred);
#endif
}
else
@ -179,7 +179,11 @@ namespace libtorrent
inline void add_files(file_storage& fs, boost::filesystem::path const& file)
{
#if BOOST_VERSION < 103600
detail::add_files_impl(fs, complete(file).branch_path(), file.leaf(), detail::default_pred);
#else
detail::add_files_impl(fs, complete(file).parent_path(), file.filename(), detail::default_pred);
#endif
}
template <class Fun>

View file

@ -143,6 +143,7 @@ namespace libtorrent
, min_announce_interval(5 * 60)
, prioritize_partial_pieces(false)
, auto_manage_startup(120)
, rate_limit_ip_overhead(true)
{}
// this is the user agent that will be sent to the tracker
@ -450,6 +451,11 @@ namespace libtorrent
// inactive until they have a fair chance to
// start downloading.
int auto_manage_startup;
// if set to true, the estimated TCP/IP overhead is
// drained from the rate limiters, to avoid exceeding
// the limits with the total traffic
bool rate_limit_ip_overhead;
};
#ifndef TORRENT_DISABLE_DHT

View file

@ -36,6 +36,6 @@ POSSIBILITY OF SUCH DAMAGE.
#define LIBTORRENT_VERSION_MAJOR 0
#define LIBTORRENT_VERSION_MINOR 14
#define LIBTORRENT_VERSION "0.14.0.0"
#define LIBTORRENT_VERSION "0.14.1.0"
#endif

View file

@ -1010,7 +1010,7 @@ namespace libtorrent
if (!allocate_disk_receive_buffer(packet_size() - 9))
return;
}
TORRENT_ASSERT(has_disk_receive_buffer());
TORRENT_ASSERT(has_disk_receive_buffer() || packet_size() == 9);
// classify the received data as protocol chatter
// or data payload for the statistics

View file

@ -171,9 +171,9 @@ namespace libtorrent
#ifdef TORRENT_WINDOWS
#ifdef UNICODE
std::wstring file_path(safe_convert(path.native_file_string()));
std::wstring file_path(safe_convert(path.external_file_string()));
#else
std::string file_path = utf8_native(path.native_file_string());
std::string file_path = utf8_native(path.external_file_string());
#endif
m_file_handle = CreateFile(
@ -205,7 +205,7 @@ namespace libtorrent
| S_IRGRP | S_IWGRP
| S_IROTH | S_IWOTH;
m_fd = ::open(path.native_file_string().c_str()
m_fd = ::open(path.external_file_string().c_str()
, map_open_mode(mode.m_mask), permissions);
if (m_fd == -1)

View file

@ -1665,7 +1665,7 @@ namespace libtorrent
if (t->alerts().should_post<peer_error_alert>())
{
t->alerts().post_alert(peer_error_alert(t->get_handle(), m_remote
, m_peer_id, "peer sent 0 length piece"));
, m_peer_id, "peer sent 0 length piece"));
}
return;
}

View file

@ -1107,9 +1107,12 @@ namespace aux {
++i;
}
// drain the IP overhead from the bandwidth limiters
m_download_channel.drain(m_stat.download_ip_overhead());
m_upload_channel.drain(m_stat.upload_ip_overhead());
if (m_settings.rate_limit_ip_overhead)
{
// drain the IP overhead from the bandwidth limiters
m_download_channel.drain(m_stat.download_ip_overhead());
m_upload_channel.drain(m_stat.upload_ip_overhead());
}
m_stat.second_tick(tick_interval);

View file

@ -159,7 +159,7 @@ namespace
// First create branch, by calling ourself recursively
create_directories_win(ph.branch_path());
// Now that parent's path exists, create the directory
std::wstring wph(safe_convert(ph.native_directory_string()));
std::wstring wph(safe_convert(ph.external_directory_string()));
CreateDirectory(wph.c_str(), 0);
return true;
}
@ -207,7 +207,7 @@ namespace
std::time_t last_write_time_win( const fs::path & ph )
{
struct _stat path_stat;
std::wstring wph(safe_convert(ph.native_file_string()));
std::wstring wph(safe_convert(ph.external_file_string()));
if ( ::_wstat( wph.c_str(), &path_stat ) != 0 )
boost::throw_exception( filesystem_error(
"boost::filesystem::last_write_time",
@ -272,9 +272,9 @@ namespace libtorrent
for (basic_directory_iterator<Path> i(old_path), end; i != end; ++i)
{
#if BOOST_VERSION < 103600
recursive_copy(i->path(), new_path / i->leaf(), ec);
recursive_copy(i->path(), new_path / i->path().leaf(), ec);
#else
recursive_copy(i->path(), new_path / i->filename(), ec);
recursive_copy(i->path(), new_path / i->path().filename(), ec);
#endif
if (ec) return;
}
@ -390,7 +390,7 @@ namespace libtorrent
|| (!compact_mode && size < s->first))
{
if (error) *error = "filesize mismatch for file '"
+ i->path.native_file_string()
+ i->path.external_file_string()
+ "', size: " + boost::lexical_cast<std::string>(size)
+ ", expected to be " + boost::lexical_cast<std::string>(s->first)
+ " bytes";
@ -403,7 +403,7 @@ namespace libtorrent
(!compact_mode && (time > s->second + 5 * 60) || time < s->second - 1))
{
if (error) *error = "timestamp mismatch for file '"
+ i->path.native_file_string()
+ i->path.external_file_string()
+ "', modification date: " + boost::lexical_cast<std::string>(time)
+ ", expected to have modification date "
+ boost::lexical_cast<std::string>(s->second);
@ -821,7 +821,7 @@ namespace libtorrent
{
if (i->size != fs->first)
{
error = "file size for '" + i->path.native_file_string()
error = "file size for '" + i->path.external_file_string()
+ "' was expected to be "
+ boost::lexical_cast<std::string>(i->size) + " bytes";
return false;
@ -847,7 +847,7 @@ namespace libtorrent
save_path = complete(save_path);
#if defined(_WIN32) && defined(UNICODE) && BOOST_VERSION < 103400
std::wstring wsave_path(safe_convert(save_path.native_file_string()));
std::wstring wsave_path(safe_convert(save_path.external_file_string()));
if (!exists_win(save_path))
CreateDirectory(wsave_path.c_str(), 0);
else if ((GetFileAttributes(wsave_path.c_str()) & FILE_ATTRIBUTE_DIRECTORY) == 0)

View file

@ -750,7 +750,7 @@ namespace libtorrent
}
m_error = j.str;
pause();
m_ses.done_checking(shared_from_this());
if (!m_abort) m_ses.done_checking(shared_from_this());
return;
}

View file

@ -903,8 +903,16 @@ void upnp::on_upnp_xml(error_code const& e
}
}
if (s.url_base.empty()) d.control_url = s.control_url;
else d.control_url = s.url_base + s.control_url;
if (!s.url_base.empty())
{
// avoid double slashes in path
if (s.url_base[s.url_base.size()-1] == '/'
&& !s.control_url.empty()
&& s.control_url[0] == '/')
s.url_base.erase(s.url_base.end()-1);
d.control_url = s.url_base + s.control_url;
}
else d.control_url = s.control_url;
std::string protocol;
std::string auth;