You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
186 lines
5.6 KiB
186 lines
5.6 KiB
X-Gentoo-Bug: 550252
|
|
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=550252
|
|
Upstream report: https://github.com/arvidn/libtorrent/issues/157
|
|
[markos]: Merge commits
|
|
Signed-off-by: Markos Chandras <hwoarang@gentoo.org>
|
|
|
|
From 61a896035782436d5a8cceef1fc997e97ebbe019 Mon Sep 17 00:00:00 2001
|
|
From: arvidn <arvid@libtorrent.org>
|
|
Date: Sat, 12 Sep 2015 09:54:40 -0400
|
|
Subject: [PATCH] remove parse_hash_fails.cpp
|
|
|
|
From 21e908ed1ea661c41e836230b8cf066688038d2b Mon Sep 17 00:00:00 2001
|
|
From: arvidn <arvid@libtorrent.org>
|
|
Date: Sat, 12 Sep 2015 09:56:30 -0400
|
|
Subject: [PATCH] remove parse_hash_fails from Jamfile also
|
|
---
|
|
tools/Makefile.am | 2 -
|
|
tools/parse_hash_fails.cpp | 104 --------------------------------------------
|
|
tools/parse_request_log.cpp | 5 ++-
|
|
tools/Jamfile | 1 -
|
|
4 files changed, 5 insertions(+), 108 deletions(-)
|
|
delete mode 100644 tools/parse_hash_fails.cpp
|
|
|
|
diff --git a/tools/Makefile.am b/tools/Makefile.am
|
|
index 0e41abd..4d90a78 100644
|
|
--- a/tools/Makefile.am
|
|
+++ b/tools/Makefile.am
|
|
@@ -1,5 +1,4 @@
|
|
tool_programs = \
|
|
- parse_hash_fails \
|
|
parse_request_log
|
|
|
|
if ENABLE_EXAMPLES
|
|
@@ -25,7 +24,6 @@ EXTRA_DIST = Jamfile \
|
|
run_regression_tests.py\
|
|
run_tests.py
|
|
|
|
-parse_hash_fails_SOURCES = parse_hash_fails.cpp
|
|
parse_request_log_SOURCES = parse_request_log.cpp
|
|
|
|
LDADD = $(top_builddir)/src/libtorrent-rasterbar.la
|
|
diff --git a/tools/parse_hash_fails.cpp b/tools/parse_hash_fails.cpp
|
|
deleted file mode 100644
|
|
index f686c5e..0000000
|
|
--- a/tools/parse_hash_fails.cpp
|
|
+++ /dev/null
|
|
@@ -1,104 +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 <stdlib.h>
|
|
-#include <string>
|
|
-#include <cstring>
|
|
-#include "libtorrent/file.hpp"
|
|
-
|
|
-using namespace libtorrent;
|
|
-
|
|
-void print_usage()
|
|
-{
|
|
- fprintf(stderr, "usage: parse_hash_fails log-directory\n");
|
|
- exit(1);
|
|
-}
|
|
-
|
|
-int main(int argc, char* argv[])
|
|
-{
|
|
- if (argc != 2) print_usage();
|
|
-
|
|
- error_code ec;
|
|
- directory d(argv[1], ec);
|
|
- if (ec)
|
|
- {
|
|
- fprintf(stderr, "failed to open directory: %s\n%s\n"
|
|
- , argv[1], ec.message().c_str());
|
|
- return 1;
|
|
- }
|
|
-
|
|
- for (; !d.done(); d.next(ec))
|
|
- {
|
|
- if (ec)
|
|
- {
|
|
- fprintf(stderr, "error listing directory: %s\n", ec.message().c_str());
|
|
- return 1;
|
|
- }
|
|
- std::string filename = d.file();
|
|
- char hash[41];
|
|
- int piece;
|
|
- int block;
|
|
- char state[10]; // good, bad
|
|
- if (sscanf(filename.c_str(), "%40s_%d_%d_%4s.block", hash, &piece, &block, state) != 4)
|
|
- {
|
|
- fprintf(stderr, "no match: %s\n", filename.c_str());
|
|
- continue;
|
|
- }
|
|
-
|
|
- if (strcmp(state, "good") != 0) continue;
|
|
-
|
|
- char target_filename[1024];
|
|
- snprintf(target_filename, sizeof(target_filename), "%s_%d_%d.diff", hash, piece, block);
|
|
-
|
|
- fprintf(stderr, "diffing %s\n", filename.c_str());
|
|
- char cmdline[2048];
|
|
- snprintf(cmdline, sizeof(cmdline), "xxd %s >temp_good", combine_path(argv[1], filename).c_str());
|
|
- system(cmdline);
|
|
- snprintf(cmdline, sizeof(cmdline), "xxd %s/%s_%d_%d_bad.block >temp_bad", argv[1], hash, piece, block);
|
|
- system(cmdline);
|
|
- snprintf(cmdline, sizeof(cmdline), "diff -y temp_good temp_bad | colordiff >%s"
|
|
- , combine_path(argv[1], target_filename).c_str());
|
|
- system(cmdline);
|
|
- }
|
|
-
|
|
- FILE* log_file = fopen(argv[1], "r");
|
|
- if (log_file == 0)
|
|
- {
|
|
- fprintf(stderr, "failed to open logfile: %s\n%d: %s\n"
|
|
- , argv[1], errno, strerror(errno));
|
|
- return 1;
|
|
- }
|
|
-
|
|
- return 0;
|
|
-}
|
|
-
|
|
-
|
|
diff --git a/tools/parse_request_log.cpp b/tools/parse_request_log.cpp
|
|
index c719f65..8394918 100644
|
|
--- a/tools/parse_request_log.cpp
|
|
+++ b/tools/parse_request_log.cpp
|
|
@@ -30,13 +30,16 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
-#include "libtorrent/file.hpp"
|
|
+#include "libtorrent/config.hpp"
|
|
#include "libtorrent/io.hpp"
|
|
#include <cstring>
|
|
#include <boost/bind.hpp>
|
|
#include <stdlib.h>
|
|
#include <map>
|
|
#include <vector>
|
|
+#include <assert.h>
|
|
+#include <stdio.h>
|
|
+#include <errno.h>
|
|
|
|
using namespace libtorrent;
|
|
using namespace libtorrent::detail; // for write_* and read_*
|
|
diff --git a/tools/Jamfile b/tools/Jamfile
|
|
index 69ee424..0c156d0 100644
|
|
--- a/tools/Jamfile
|
|
+++ b/tools/Jamfile
|
|
@@ -33,7 +33,6 @@ project tools
|
|
<link>static
|
|
;
|
|
|
|
-exe parse_hash_fails : parse_hash_fails.cpp ;
|
|
exe parse_request_log : parse_request_log.cpp ;
|
|
exe dht : dht_put.cpp : <include>../ed25519/src ;
|
|
|