forked from premiere/premiere-libtorrent
remove some old unmaintained example code. make examples depend less on libtorrent internals
This commit is contained in:
parent
1b6d64107d
commit
35141733fb
|
@ -22,7 +22,6 @@ exe simple_client : simple_client.cpp ;
|
|||
exe dump_torrent : dump_torrent.cpp ;
|
||||
exe make_torrent : make_torrent.cpp ;
|
||||
exe connection_tester : connection_tester.cpp ;
|
||||
exe fragmentation_test : fragmentation_test.cpp ;
|
||||
exe rss_reader : rss_reader.cpp ;
|
||||
exe upnp_test : upnp_test.cpp ;
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
example_programs = \
|
||||
client_test \
|
||||
dump_torrent \
|
||||
fragmentation_test\
|
||||
make_torrent \
|
||||
simple_client \
|
||||
rss_reader \
|
||||
|
@ -33,9 +32,6 @@ connection_tester_SOURCES = connection_tester.cpp
|
|||
rss_reader_SOURCES = rss_reader.cpp
|
||||
#rss_reader_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la
|
||||
|
||||
fragmentation_test_SOURCES = fragmentation_test.cpp
|
||||
#fragmentation_test_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la
|
||||
|
||||
upnp_test_SOURCES = upnp_test.cpp
|
||||
#upnp_test_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la
|
||||
|
||||
|
|
|
@ -896,6 +896,15 @@ torrent_status const& get_active_torrent(std::vector<torrent_status const*> cons
|
|||
return *filtered_handles[active_torrent];
|
||||
}
|
||||
|
||||
char const* timestamp()
|
||||
{
|
||||
time_t t = std::time(0);
|
||||
tm* timeinfo = std::localtime(&t);
|
||||
static char str[200];
|
||||
std::strftime(str, 200, "%b %d %X", timeinfo);
|
||||
return str;
|
||||
}
|
||||
|
||||
void print_alert(libtorrent::alert const* a, std::string& str)
|
||||
{
|
||||
using namespace libtorrent;
|
||||
|
@ -911,7 +920,7 @@ void print_alert(libtorrent::alert const* a, std::string& str)
|
|||
}
|
||||
#endif
|
||||
str += "[";
|
||||
str += time_now_string();
|
||||
str += timestamp();
|
||||
str += "] ";
|
||||
str += a->message();
|
||||
#ifdef ANSI_TERMINAL_COLORS
|
||||
|
@ -919,7 +928,7 @@ void print_alert(libtorrent::alert const* a, std::string& str)
|
|||
#endif
|
||||
|
||||
if (g_log_file)
|
||||
fprintf(g_log_file, "[%s] %s\n", time_now_string(), a->message().c_str());
|
||||
fprintf(g_log_file, "[%s] %s\n", timestamp(), a->message().c_str());
|
||||
}
|
||||
|
||||
int save_file(std::string const& filename, std::vector<char>& v)
|
||||
|
@ -961,7 +970,7 @@ bool handle_alert(libtorrent::session& ses, libtorrent::alert* a
|
|||
{
|
||||
char msg[256];
|
||||
snprintf(msg, sizeof(msg), "ERROR. could not load certificate %s: %s\n", cert.c_str(), ec.message().c_str());
|
||||
if (g_log_file) fprintf(g_log_file, "[%s] %s\n", time_now_string(), msg);
|
||||
if (g_log_file) fprintf(g_log_file, "[%s] %s\n", timestamp(), msg);
|
||||
return true;
|
||||
}
|
||||
stat_file(priv, &st, ec);
|
||||
|
@ -969,13 +978,13 @@ bool handle_alert(libtorrent::session& ses, libtorrent::alert* a
|
|||
{
|
||||
char msg[256];
|
||||
snprintf(msg, sizeof(msg), "ERROR. could not load private key %s: %s\n", priv.c_str(), ec.message().c_str());
|
||||
if (g_log_file) fprintf(g_log_file, "[%s] %s\n", time_now_string(), msg);
|
||||
if (g_log_file) fprintf(g_log_file, "[%s] %s\n", timestamp(), msg);
|
||||
return true;
|
||||
}
|
||||
|
||||
char msg[256];
|
||||
snprintf(msg, sizeof(msg), "loaded certificate %s and key %s\n", cert.c_str(), priv.c_str());
|
||||
if (g_log_file) fprintf(g_log_file, "[%s] %s\n", time_now_string(), msg);
|
||||
if (g_log_file) fprintf(g_log_file, "[%s] %s\n", timestamp(), msg);
|
||||
|
||||
h.set_ssl_certificate(cert, priv, "certificates/dhparams.pem", "1234");
|
||||
h.resume();
|
||||
|
@ -1961,7 +1970,7 @@ int main(int argc, char* argv[])
|
|||
// loop through the alert queue to see if anything has happened.
|
||||
std::deque<alert*> alerts;
|
||||
ses.pop_alerts(&alerts);
|
||||
std::string now = time_now_string();
|
||||
std::string now = timestamp();
|
||||
for (std::deque<alert*>::iterator i = alerts.begin()
|
||||
, end(alerts.end()); i != end; ++i)
|
||||
{
|
||||
|
@ -2471,7 +2480,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
std::deque<alert*> alerts;
|
||||
ses.pop_alerts(&alerts);
|
||||
std::string now = time_now_string();
|
||||
std::string now = timestamp();
|
||||
for (std::deque<alert*>::iterator i = alerts.begin()
|
||||
, end(alerts.end()); i != end; ++i)
|
||||
{
|
||||
|
|
|
@ -149,93 +149,6 @@ int line_longer_than(libtorrent::lazy_entry const& e, int limit)
|
|||
return line_len;
|
||||
}
|
||||
|
||||
std::string print_entry(libtorrent::lazy_entry const& e, bool single_line = false, int indent = 0)
|
||||
{
|
||||
using namespace libtorrent;
|
||||
|
||||
char indent_str[200];
|
||||
memset(indent_str, ' ', 200);
|
||||
indent_str[0] = ',';
|
||||
indent_str[1] = '\n';
|
||||
indent_str[199] = 0;
|
||||
if (indent < 197 && indent >= 0) indent_str[indent+2] = 0;
|
||||
std::string ret;
|
||||
switch (e.type())
|
||||
{
|
||||
case lazy_entry::none_t: return "none";
|
||||
case lazy_entry::int_t:
|
||||
{
|
||||
char str[100];
|
||||
snprintf(str, sizeof(str), "%" PRId64, e.int_value());
|
||||
return str;
|
||||
}
|
||||
case lazy_entry::string_t:
|
||||
{
|
||||
bool printable = true;
|
||||
char const* str = e.string_ptr();
|
||||
for (int i = 0; i < e.string_length(); ++i)
|
||||
{
|
||||
using namespace std;
|
||||
if (is_print((unsigned char)str[i])) continue;
|
||||
printable = false;
|
||||
break;
|
||||
}
|
||||
ret += "'";
|
||||
if (printable)
|
||||
{
|
||||
ret += e.string_value();
|
||||
ret += "'";
|
||||
return ret;
|
||||
}
|
||||
for (int i = 0; i < e.string_length(); ++i)
|
||||
{
|
||||
char tmp[5];
|
||||
snprintf(tmp, sizeof(tmp), "%02x", (unsigned char)str[i]);
|
||||
ret += tmp;
|
||||
}
|
||||
ret += "'";
|
||||
return ret;
|
||||
}
|
||||
case lazy_entry::list_t:
|
||||
{
|
||||
ret += '[';
|
||||
bool one_liner = line_longer_than(e, 200) != -1 || single_line;
|
||||
|
||||
if (!one_liner) ret += indent_str + 1;
|
||||
for (int i = 0; i < e.list_size(); ++i)
|
||||
{
|
||||
if (i == 0 && one_liner) ret += " ";
|
||||
ret += ::print_entry(*e.list_at(i), single_line, indent + 2);
|
||||
if (i < e.list_size() - 1) ret += (one_liner?", ":indent_str);
|
||||
else ret += (one_liner?" ":indent_str+1);
|
||||
}
|
||||
ret += "]";
|
||||
return ret;
|
||||
}
|
||||
case lazy_entry::dict_t:
|
||||
{
|
||||
ret += "{";
|
||||
bool one_liner = line_longer_than(e, 200) != -1 || single_line;
|
||||
|
||||
if (!one_liner) ret += indent_str+1;
|
||||
for (int i = 0; i < e.dict_size(); ++i)
|
||||
{
|
||||
if (i == 0 && one_liner) ret += " ";
|
||||
std::pair<std::string, lazy_entry const*> ent = e.dict_at(i);
|
||||
ret += "'";
|
||||
ret += ent.first;
|
||||
ret += "': ";
|
||||
ret += ::print_entry(*ent.second, single_line, indent + 2);
|
||||
if (i < e.dict_size() - 1) ret += (one_liner?", ":indent_str);
|
||||
else ret += (one_liner?" ":indent_str+1);
|
||||
}
|
||||
ret += "}";
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
using namespace libtorrent;
|
||||
|
@ -252,15 +165,15 @@ int main(int argc, char* argv[])
|
|||
if (argc > 2) item_limit = atoi(argv[2]);
|
||||
if (argc > 3) depth_limit = atoi(argv[3]);
|
||||
|
||||
int size = file_size(argv[1]);
|
||||
if (size > 40 * 1000000)
|
||||
{
|
||||
fprintf(stderr, "file too big (%d), aborting\n", size);
|
||||
return 1;
|
||||
}
|
||||
std::vector<char> buf(size);
|
||||
std::vector<char> buf;
|
||||
error_code ec;
|
||||
int ret = load_file(argv[1], buf, ec, 40 * 1000000);
|
||||
if (ret == -1)
|
||||
{
|
||||
fprintf(stderr, "file too big, aborting\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ret != 0)
|
||||
{
|
||||
fprintf(stderr, "failed to load file: %s\n", ec.message().c_str());
|
||||
|
@ -273,7 +186,7 @@ int main(int argc, char* argv[])
|
|||
ret = lazy_bdecode(&buf[0], &buf[0] + buf.size(), e, ec, &pos
|
||||
, depth_limit, item_limit);
|
||||
|
||||
printf("\n\n----- raw info -----\n\n%s\n", ::print_entry(e).c_str());
|
||||
printf("\n\n----- raw info -----\n\n%s\n", print_entry(e).c_str());
|
||||
|
||||
if (ret != 0)
|
||||
{
|
||||
|
|
|
@ -1,152 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2010, Arvid Norberg
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the author nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "libtorrent/storage.hpp"
|
||||
#include "libtorrent/file_pool.hpp"
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace libtorrent;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 3 && argc != 2)
|
||||
{
|
||||
fprintf(stderr, "Usage: fragmentation_test torrent-file file-storage-path\n"
|
||||
" fragmentation_test file\n\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (argc == 2)
|
||||
{
|
||||
error_code ec;
|
||||
file f(argv[1], file::read_only, ec);
|
||||
if (ec)
|
||||
{
|
||||
fprintf(stderr, "Error opening file %s: %s\n", argv[1], ec.message().c_str());
|
||||
return 1;
|
||||
}
|
||||
size_type off = f.phys_offset(0);
|
||||
printf("physical offset of file %s: %" PRId64 "\n", argv[1], off);
|
||||
return 0;
|
||||
}
|
||||
|
||||
error_code ec;
|
||||
boost::intrusive_ptr<torrent_info> ti(new torrent_info(argv[1], ec));
|
||||
|
||||
if (ec)
|
||||
{
|
||||
fprintf(stderr, "Error while loading torrent file: %s\n", ec.message().c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
file_pool fp;
|
||||
boost::shared_ptr<storage_interface> st(default_storage_constructor(ti->files(), 0, argv[2], fp, std::vector<boost::uint8_t>()));
|
||||
|
||||
// the first field is the piece index, the second
|
||||
// one is the physical location of the piece on disk
|
||||
std::vector<std::pair<int, size_type> > pieces;
|
||||
|
||||
// make sure all the files are there
|
||||
/* std::vector<std::pair<size_type, std::time_t> > files = get_filesizes(ti->files(), argv[2]);
|
||||
for (int i = 0; i < ti->num_files(); ++i)
|
||||
{
|
||||
if (ti->file_at(i).size == files[i].first) continue;
|
||||
fprintf(stderr, "Files for this torrent are missing or incomplete: %s was %" PRId64 " bytes, expected %" PRId64 " bytes\n"
|
||||
, ti->files().file_path(ti->file_at(i)).c_str(), files[i].first, ti->file_at(i).size);
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
bool warned = false;
|
||||
for (int i = 0; i < ti->num_pieces(); ++i)
|
||||
{
|
||||
pieces.push_back(std::make_pair(i, st->physical_offset(i, 0)));
|
||||
if (pieces.back().second == size_type(i) * ti->piece_length())
|
||||
{
|
||||
if (!warned)
|
||||
{
|
||||
fprintf(stderr, "The files are incomplete\n");
|
||||
warned = true;
|
||||
}
|
||||
pieces.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
// this suggests that the OS doesn't support physical offset
|
||||
// or that the file doesn't exist or is incomplete
|
||||
if (pieces.empty())
|
||||
{
|
||||
fprintf(stderr, "Your operating system or filesystem "
|
||||
"does not appear to support querying physical disk offset\n");
|
||||
}
|
||||
|
||||
FILE* f = fopen("fragmentation.log", "w+");
|
||||
if (f == 0)
|
||||
{
|
||||
fprintf(stderr, "error while opening log file: %s\n", strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < pieces.size(); ++i)
|
||||
{
|
||||
fprintf(f, "%d %" PRId64 "\n", pieces[i].first, pieces[i].second);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
f = fopen("fragmentation.gnuplot", "w+");
|
||||
if (f == 0)
|
||||
{
|
||||
fprintf(stderr, "error while opening gnuplot file: %s\n", strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
fprintf(f,
|
||||
"set term png size 1200,800\n"
|
||||
"set output \"fragmentation.png\"\n"
|
||||
"set xrange [*:*]\n"
|
||||
"set xlabel \"piece\"\n"
|
||||
"set ylabel \"drive offset\"\n"
|
||||
"set key box\n"
|
||||
"set title \"fragmentation for '%s'\"\n"
|
||||
"set tics nomirror\n"
|
||||
"plot \"fragmentation.log\" using 1:2 with points lt rgb \"#e07070\" notitle axis x1y1\n"
|
||||
, ti->name().c_str());
|
||||
|
||||
fclose(f);
|
||||
|
||||
system("gnuplot fragmentation.gnuplot");
|
||||
}
|
||||
|
||||
|
|
@ -34,6 +34,15 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/session.hpp"
|
||||
#include "libtorrent/alert_types.hpp"
|
||||
|
||||
char const* timestamp()
|
||||
{
|
||||
time_t t = std::time(0);
|
||||
tm* timeinfo = std::localtime(&t);
|
||||
static char str[200];
|
||||
std::strftime(str, 200, "%b %d %X", timeinfo);
|
||||
return str;
|
||||
}
|
||||
|
||||
void print_alert(libtorrent::alert const* a)
|
||||
{
|
||||
using namespace libtorrent;
|
||||
|
@ -47,7 +56,7 @@ void print_alert(libtorrent::alert const* a)
|
|||
printf("%s","\x1b[33m");
|
||||
}
|
||||
|
||||
printf("[%s] %s\n", time_now_string(), a->message().c_str());
|
||||
printf("[%s] %s\n", timestamp(), a->message().c_str());
|
||||
printf("%s", "\x1b[0m");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2012, Arvid Norberg
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the author nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/session.hpp"
|
||||
#include "libtorrent/socket_type.hpp"
|
||||
#include "libtorrent/utp_socket_manager.hpp"
|
||||
#include "libtorrent/utp_stream.hpp"
|
||||
|
||||
using namespace libtorrent;
|
||||
|
||||
void on_connect(error_code const& e)
|
||||
{
|
||||
}
|
||||
|
||||
void on_udp_receive(error_code const& e, udp::endpoint const& ep
|
||||
, char const* buf, int size)
|
||||
{
|
||||
}
|
||||
|
||||
void on_utp_incoming(void* userdata
|
||||
, boost::shared_ptr<utp_stream> const& utp_sock)
|
||||
{
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
//int rtt, rtt_var;
|
||||
//int max_window, cur_window;
|
||||
//int delay_factor, window_factor, scaled_gain;
|
||||
|
||||
/*session s;
|
||||
s.listen_on(std::make_pair(6881, 6889));*/
|
||||
|
||||
io_service ios;
|
||||
connection_queue cc(ios);
|
||||
udp_socket udp_sock(ios, boost::bind(&on_udp_receive, _1, _2, _3, _4), cc);
|
||||
|
||||
void* userdata;
|
||||
utp_socket_manager utp_sockets(udp_sock, boost::bind(&on_utp_incoming, _1, _2), userdata);
|
||||
|
||||
/*error_code ec;
|
||||
utp_stream sock(ios, cc);
|
||||
sock.bind(udp::endpoint(address_v4::any(), 0), ec);
|
||||
|
||||
tcp::endpoint ep(address_v4::from_string("239.192.152.143", ec), 6771);
|
||||
|
||||
sock.async_connect(ep, boost::bind(on_connect, _1));*/
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -74,7 +74,8 @@ namespace libtorrent
|
|||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
||||
// this is a SHA-1 hash class.
|
||||
//
|
||||
// You use it by first instantiating it, then call ``update()`` to feed it
|
||||
// with data. i.e. you don't have to keep the entire buffer of which you want to
|
||||
// create the hash in memory. You can feed the hasher parts of it at a time. When
|
||||
|
@ -89,11 +90,14 @@ namespace libtorrent
|
|||
//
|
||||
// The sha1-algorithm used was implemented by Steve Reid and released as public domain.
|
||||
// For more info, see ``src/sha1.cpp``.
|
||||
class TORRENT_EXTRA_EXPORT hasher
|
||||
class TORRENT_EXPORT hasher
|
||||
{
|
||||
public:
|
||||
|
||||
hasher();
|
||||
|
||||
// this is the same as default constructing followed by a call to
|
||||
// ``update(data, len)``.
|
||||
hasher(const char* data, int len);
|
||||
|
||||
#ifdef TORRENT_USE_GCRYPT
|
||||
|
@ -101,10 +105,16 @@ namespace libtorrent
|
|||
hasher& operator=(hasher const& h);
|
||||
#endif
|
||||
|
||||
// append the following bytes to what is being hashed
|
||||
hasher& update(std::string const& data) { update(data.c_str(), data.size()); return *this; }
|
||||
hasher& update(const char* data, int len);
|
||||
|
||||
// returns the SHA-1 digest of the buffers previously passed to
|
||||
// update() and the hasher constructor.
|
||||
sha1_hash final();
|
||||
|
||||
// restore the hasher state to be as if the hasher has just been
|
||||
// default constructed.
|
||||
void reset();
|
||||
|
||||
#ifdef TORRENT_USE_GCRYPT
|
||||
|
|
|
@ -386,7 +386,9 @@ namespace libtorrent
|
|||
lazy_entry val;
|
||||
};
|
||||
|
||||
TORRENT_EXTRA_EXPORT std::string print_entry(lazy_entry const& e
|
||||
// print the bencoded structure in a human-readable format to a stting
|
||||
// that's returned.
|
||||
TORRENT_EXPORT std::string print_entry(lazy_entry const& e
|
||||
, bool single_line = false, int indent = 0);
|
||||
|
||||
// get the ``error_category`` for bdecode errors
|
||||
|
|
|
@ -58,12 +58,6 @@ namespace libtorrent
|
|||
|
||||
char const* time_now_string()
|
||||
{
|
||||
// time_t t = std::time(0);
|
||||
// tm* timeinfo = std::localtime(&t);
|
||||
// static char str[200];
|
||||
// std::strftime(str, 200, "%b %d %X", timeinfo);
|
||||
// return str;
|
||||
|
||||
static const ptime start = time_now_hires();
|
||||
static char ret[200];
|
||||
int t = total_milliseconds(time_now_hires() - start);
|
||||
|
|
Loading…
Reference in New Issue