don't call libtorrent functions from global constructor
This commit is contained in:
parent
17bc05c582
commit
ddf2c2e1ca
|
@ -196,9 +196,6 @@ std::vector<libtorrent::dht_lookup> dht_active_requests;
|
|||
std::vector<libtorrent::dht_routing_bucket> dht_routing_table;
|
||||
#endif
|
||||
|
||||
torrent_view view;
|
||||
session_view ses_view;
|
||||
|
||||
int load_file(std::string const& filename, std::vector<char>& v
|
||||
, libtorrent::error_code& ec, int limit = 8000000)
|
||||
{
|
||||
|
@ -910,7 +907,8 @@ int save_file(std::string const& filename, std::vector<char>& v)
|
|||
|
||||
// returns true if the alert was handled (and should not be printed to the log)
|
||||
// returns false if the alert was not handled
|
||||
bool handle_alert(libtorrent::session& ses, libtorrent::alert* a
|
||||
bool handle_alert(torrent_view& view, session_view& ses_view
|
||||
, libtorrent::session& ses, libtorrent::alert* a
|
||||
, handles_t& files, std::set<libtorrent::torrent_handle>& non_files)
|
||||
{
|
||||
using namespace libtorrent;
|
||||
|
@ -1297,6 +1295,9 @@ int main(int argc, char* argv[])
|
|||
using namespace libtorrent;
|
||||
namespace lt = libtorrent;
|
||||
|
||||
torrent_view view;
|
||||
session_view ses_view;
|
||||
|
||||
settings_pack settings;
|
||||
settings.set_int(settings_pack::cache_size, cache_size);
|
||||
settings.set_int(settings_pack::active_loaded_limit, 20);
|
||||
|
@ -1957,7 +1958,7 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
TORRENT_TRY
|
||||
{
|
||||
if (!::handle_alert(ses, *i, files, non_files))
|
||||
if (!::handle_alert(view, ses_view, ses, *i, files, non_files))
|
||||
{
|
||||
// if we didn't handle the alert, print it to the log
|
||||
std::string event_string;
|
||||
|
@ -2320,7 +2321,7 @@ int main(int argc, char* argv[])
|
|||
for (std::vector<alert*>::iterator i = alerts.begin()
|
||||
, end(alerts.end()); i != end; ++i)
|
||||
{
|
||||
if (!::handle_alert(ses, *i, files, non_files))
|
||||
if (!::handle_alert(view, ses_view, ses, *i, files, non_files))
|
||||
{
|
||||
// if we didn't handle the alert, print it to the log
|
||||
std::string event_string;
|
||||
|
|
Loading…
Reference in New Issue