summaryrefslogtreecommitdiff
blob: 53ba0b8e3f367d4ec191f646cc2103c75169391c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
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 ;