fix dynamic linking (Jamfile and dependencies on internals)

This commit is contained in:
Arvid Norberg 2015-01-01 18:03:56 +00:00
parent a1c1f9393d
commit c2a05228fd
4 changed files with 50 additions and 11 deletions

View File

@ -21,6 +21,7 @@ build_features:
- asserts=production debug
- asserts=on release
- variant=test_barebones
- link=shared boost-link=shared
project: libtorrent

View File

@ -421,7 +421,7 @@ feature upnp-logging : off on : composite propagated link-incompatible ;
feature.compose <upnp-logging>on : <define>TORRENT_UPNP_LOGGING ;
feature boost : system source : link-incompatible propagated ;
feature boost-link : static shared : composite ;
feature boost-link : static shared : propagated composite ;
feature debug-iterators : off on : composite propagated link-incompatible ;
feature.compose <debug-iterators>on : <define>_SCL_SECURE=1 <define>_GLIBCXX_DEBUG ;

View File

@ -65,7 +65,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/bitfield.hpp"
#include "libtorrent/peer_info.hpp"
#include "libtorrent/lazy_entry.hpp"
#include "libtorrent/escape_string.hpp" // for convert_path_to_posix
#include "libtorrent/add_torrent_params.hpp"
#include "libtorrent/time.hpp"
#include "libtorrent/create_torrent.hpp"
@ -594,6 +593,35 @@ std::string peer;
using boost::bind;
std::string path_to_url(std::string f)
{
std::string ret = "file://"
#ifdef TORRENT_WINDOWS
"/"
#endif
;
static char const hex_chars[] = "0123456789abcdef";
static const char unreserved[] =
"/-_!.~*()ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
"0123456789";
for (int i = 0; i < f.size(); ++i)
{
#ifdef TORRENT_WINDOWS
if (f[i] == '\\') ret.push_back('/');
else
#endif
if (std::strchr(unreserved, f[i]) != NULL) ret.push_back(f[i]);
else
{
ret.push_back('%');
ret.push_back(hex_chars[f[i] >> 4]);
ret.push_back(hex_chars[f[i] & 0xf]);
}
}
return f;
}
// monitored_dir is true if this torrent is added because
// it was found in the directory that is monitored. If it
// is, it should be remembered so that it can be removed
@ -625,12 +653,7 @@ void add_torrent(libtorrent::session& ses
error_code ec;
load_file(filename.c_str(), p.resume_data, ec);
#ifdef TORRENT_WINDOWS
convert_path_to_posix(torrent);
p.url = "file:///" + escape_path(torrent.c_str(), torrent.size());
#else
p.url = "file://" + escape_path(torrent.c_str(), torrent.size());
#endif
p.url = path_to_url(torrent);
p.save_path = save_path;
p.storage_mode = (storage_mode_t)allocation_mode;
p.flags |= add_torrent_params::flag_paused;
@ -926,7 +949,8 @@ bool handle_alert(libtorrent::session& ses, libtorrent::alert* a
if (p->error)
{
fprintf(stderr, "failed to add torrent: %s %s\n", filename.c_str(), p->error.message().c_str());
fprintf(stderr, "failed to add torrent: %s %s\n", filename.c_str()
, p->error.message().c_str());
}
else
{
@ -1466,7 +1490,10 @@ int main(int argc, char* argv[])
, errno, strerror(errno));
if (bind_to_interface.empty()) bind_to_interface = "0.0.0.0";
settings.set_str(settings_pack::listen_interfaces, bind_to_interface + ":" + to_string(listen_port).elems);
char iface_str[100];
snprintf(iface_str, sizeof(iface_str), "%s:%d", bind_to_interface.c_str()
, listen_port);
settings.set_str(settings_pack::listen_interfaces, iface_str);
#ifndef TORRENT_DISABLE_DHT
dht_settings dht;

View File

@ -384,8 +384,19 @@ struct peer_conn
float up = (boost::int64_t(blocks_sent) * 0x4000) / time / 1000.f;
float down = (boost::int64_t(blocks_received) * 0x4000) / time / 1000.f;
error_code e;
char ep_str[200];
address const& addr = s.local_endpoint(e).address();
#if TORRENT_USE_IPV6
if (addr.is_v6())
snprintf(ep_str, sizeof(ep_str), "[%s]:%d", addr.to_string(e).c_str()
, s.local_endpoint(e).port());
else
#endif
snprintf(ep_str, sizeof(ep_str), "%s:%d", addr.to_string(e).c_str()
, s.local_endpoint(e).port());
printf("%s ep: %s sent: %d received: %d duration: %d ms up: %.1fMB/s down: %.1fMB/s\n"
, tmp, libtorrent::print_endpoint(s.local_endpoint(e)).c_str(), blocks_sent, blocks_received, time, up, down);
, tmp, ep_str, blocks_sent, blocks_received, time, up, down);
if (seed) --num_seeds;
}