Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
NetWork
Opentracker
提交
05e0de1a
O
Opentracker
项目概览
NetWork
/
Opentracker
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opentracker
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
05e0de1a
编写于
5月 18, 2012
作者:
E
erdgeist
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a top100 for most popular torrents
上级
914e0ac3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
29 deletion
+34
-29
ot_http.c
ot_http.c
+1
-1
ot_mutex.h
ot_mutex.h
+4
-3
ot_stats.c
ot_stats.c
+29
-25
未找到文件。
ot_http.c
浏览文件 @
05e0de1a
...
...
@@ -175,7 +175,7 @@ static const ot_keywords keywords_mode[] =
{
{
"peer"
,
TASK_STATS_PEERS
},
{
"conn"
,
TASK_STATS_CONNS
},
{
"scrp"
,
TASK_STATS_SCRAPE
},
{
"udp4"
,
TASK_STATS_UDP
},
{
"tcp4"
,
TASK_STATS_TCP
},
{
"busy"
,
TASK_STATS_BUSY_NETWORKS
},
{
"torr"
,
TASK_STATS_TORRENTS
},
{
"fscr"
,
TASK_STATS_FULLSCRAPE
},
{
"s24s"
,
TASK_STATS_SLASH24S
},
{
"tpbs"
,
TASK_STATS_TPB
},
{
"herr"
,
TASK_STATS_HTTPERRORS
},
{
"completed"
,
TASK_STATS_COMPLETED
},
{
"top10"
,
TASK_STATS_TOP10
},
{
"renew"
,
TASK_STATS_RENEW
},
{
"syncs"
,
TASK_STATS_SYNCS
},
{
"version"
,
TASK_STATS_VERSION
},
{
"top10
0"
,
TASK_STATS_TOP100
},
{
"top10
"
,
TASK_STATS_TOP10
},
{
"renew"
,
TASK_STATS_RENEW
},
{
"syncs"
,
TASK_STATS_SYNCS
},
{
"version"
,
TASK_STATS_VERSION
},
{
"everything"
,
TASK_STATS_EVERYTHING
},
{
"statedump"
,
TASK_FULLSCRAPE_TRACKERSTATE
},
{
"fulllog"
,
TASK_STATS_FULLLOG
},
{
"woodpeckers"
,
TASK_STATS_WOODPECKERS
},
#ifdef WANT_LOG_NUMWANT
...
...
ot_mutex.h
浏览文件 @
05e0de1a
...
...
@@ -39,9 +39,10 @@ typedef enum {
TASK_STATS_PEERS
=
0x0102
,
TASK_STATS_SLASH24S
=
0x0103
,
TASK_STATS_TOP10
=
0x0104
,
TASK_STATS_EVERYTHING
=
0x0105
,
TASK_STATS_FULLLOG
=
0x0106
,
TASK_STATS_WOODPECKERS
=
0x0107
,
TASK_STATS_TOP100
=
0x0105
,
TASK_STATS_EVERYTHING
=
0x0106
,
TASK_STATS_FULLLOG
=
0x0107
,
TASK_STATS_WOODPECKERS
=
0x0108
,
TASK_FULLSCRAPE
=
0x0200
,
/* Default mode */
TASK_FULLSCRAPE_TPB_BINARY
=
0x0201
,
...
...
ot_stats.c
浏览文件 @
05e0de1a
...
...
@@ -93,7 +93,7 @@ static stats_network_node *stats_network_counters_root;
static
int
stat_increase_network_count
(
stats_network_node
**
pnode
,
int
depth
,
uintptr_t
ip
)
{
int
foo
=
__LDR
(
ip
,
depth
);
stats_network_node
*
node
;
if
(
!*
pnode
)
{
*
pnode
=
malloc
(
sizeof
(
stats_network_node
)
);
if
(
!*
pnode
)
...
...
@@ -125,7 +125,7 @@ static int stats_shift_down_network_count( stats_network_node **node, int depth,
free
(
*
node
);
*
node
=
NULL
;
}
return
rest
;
}
...
...
@@ -295,30 +295,33 @@ static char*to_hex(char*d,uint8_t*s){char*m="0123456789ABCDEF";char *t=d;char*e=
typedef
struct
{
size_t
val
;
ot_torrent
*
torrent
;
}
ot_record
;
/* Fetches stats from tracker */
size_t
stats_top
10_txt
(
char
*
reply
)
{
size_t
stats_top
_txt
(
char
*
reply
,
int
amount
)
{
size_t
j
;
ot_record
top10
s
[
10
],
top10c
[
1
0
];
ot_record
top10
0s
[
100
],
top100c
[
10
0
];
char
*
r
=
reply
,
hex_out
[
42
];
int
idx
,
bucket
;
byte_zero
(
top10s
,
sizeof
(
top10s
)
);
byte_zero
(
top10c
,
sizeof
(
top10c
)
);
if
(
amount
>
100
)
amount
=
100
;
byte_zero
(
top100s
,
sizeof
(
top100s
)
);
byte_zero
(
top100c
,
sizeof
(
top100c
)
);
for
(
bucket
=
0
;
bucket
<
OT_BUCKET_COUNT
;
++
bucket
)
{
ot_vector
*
torrents_list
=
mutex_bucket_lock
(
bucket
);
for
(
j
=
0
;
j
<
torrents_list
->
size
;
++
j
)
{
ot_peerlist
*
peer_list
=
(
((
ot_torrent
*
)(
torrents_list
->
data
))[
j
]
).
peer_list
;
int
idx
=
9
;
while
(
(
idx
>=
0
)
&&
(
peer_list
->
peer_count
>
top1
0c
[
idx
].
val
)
)
--
idx
;
if
(
idx
++
!=
9
)
{
memmove
(
top10
c
+
idx
+
1
,
top10c
+
idx
,
(
9
-
idx
)
*
sizeof
(
ot_record
)
);
top10c
[
idx
].
val
=
peer_list
->
peer_count
;
top10c
[
idx
].
torrent
=
(
ot_torrent
*
)(
torrents_list
->
data
)
+
j
;
int
idx
=
amount
-
1
;
while
(
(
idx
>=
0
)
&&
(
peer_list
->
peer_count
>
top10
0c
[
idx
].
val
)
)
--
idx
;
if
(
idx
++
!=
amount
-
1
)
{
memmove
(
top10
0c
+
idx
+
1
,
top100c
+
idx
,
(
amount
-
1
-
idx
)
*
sizeof
(
ot_record
)
);
top10
0
c
[
idx
].
val
=
peer_list
->
peer_count
;
top10
0
c
[
idx
].
torrent
=
(
ot_torrent
*
)(
torrents_list
->
data
)
+
j
;
}
idx
=
9
;
while
(
(
idx
>=
0
)
&&
(
peer_list
->
seed_count
>
top1
0s
[
idx
].
val
)
)
--
idx
;
if
(
idx
++
!=
9
)
{
memmove
(
top10
s
+
idx
+
1
,
top10s
+
idx
,
(
9
-
idx
)
*
sizeof
(
ot_record
)
);
top10s
[
idx
].
val
=
peer_list
->
seed_count
;
top10s
[
idx
].
torrent
=
(
ot_torrent
*
)(
torrents_list
->
data
)
+
j
;
idx
=
amount
-
1
;
while
(
(
idx
>=
0
)
&&
(
peer_list
->
seed_count
>
top10
0s
[
idx
].
val
)
)
--
idx
;
if
(
idx
++
!=
amount
-
1
)
{
memmove
(
top10
0s
+
idx
+
1
,
top100s
+
idx
,
(
amount
-
1
-
idx
)
*
sizeof
(
ot_record
)
);
top10
0
s
[
idx
].
val
=
peer_list
->
seed_count
;
top10
0
s
[
idx
].
torrent
=
(
ot_torrent
*
)(
torrents_list
->
data
)
+
j
;
}
}
mutex_bucket_unlock
(
bucket
,
0
);
...
...
@@ -326,14 +329,14 @@ size_t stats_top10_txt( char * reply ) {
return
0
;
}
r
+=
sprintf
(
r
,
"Top
10 torrents by peers:
\n
"
);
for
(
idx
=
0
;
idx
<
10
;
++
idx
)
if
(
top10c
[
idx
].
torrent
)
r
+=
sprintf
(
r
,
"
\t
%zd
\t
%s
\n
"
,
top10
c
[
idx
].
val
,
to_hex
(
hex_out
,
top1
0c
[
idx
].
torrent
->
hash
)
);
r
+=
sprintf
(
r
,
"Top
10 torrents by seeds:
\n
"
);
for
(
idx
=
0
;
idx
<
10
;
++
idx
)
if
(
top10s
[
idx
].
torrent
)
r
+=
sprintf
(
r
,
"
\t
%zd
\t
%s
\n
"
,
top10
s
[
idx
].
val
,
to_hex
(
hex_out
,
top1
0s
[
idx
].
torrent
->
hash
)
);
r
+=
sprintf
(
r
,
"Top
%d torrents by peers:
\n
"
,
amount
);
for
(
idx
=
0
;
idx
<
amount
;
++
idx
)
if
(
top10
0
c
[
idx
].
torrent
)
r
+=
sprintf
(
r
,
"
\t
%zd
\t
%s
\n
"
,
top10
0c
[
idx
].
val
,
to_hex
(
hex_out
,
top10
0c
[
idx
].
torrent
->
hash
)
);
r
+=
sprintf
(
r
,
"Top
%d torrents by seeds:
\n
"
,
amount
);
for
(
idx
=
0
;
idx
<
amount
;
++
idx
)
if
(
top10
0
s
[
idx
].
torrent
)
r
+=
sprintf
(
r
,
"
\t
%zd
\t
%s
\n
"
,
top10
0s
[
idx
].
val
,
to_hex
(
hex_out
,
top10
0s
[
idx
].
torrent
->
hash
)
);
return
r
-
reply
;
}
...
...
@@ -609,7 +612,8 @@ static void stats_make( int *iovec_entries, struct iovec **iovector, ot_tasktype
case
TASK_STATS_TORRENTS
:
r
+=
stats_torrents_mrtg
(
r
);
break
;
case
TASK_STATS_PEERS
:
r
+=
stats_peers_mrtg
(
r
);
break
;
case
TASK_STATS_SLASH24S
:
r
+=
stats_slash24s_txt
(
r
,
128
);
break
;
case
TASK_STATS_TOP10
:
r
+=
stats_top10_txt
(
r
);
break
;
case
TASK_STATS_TOP10
:
r
+=
stats_top_txt
(
r
,
10
);
break
;
case
TASK_STATS_TOP100
:
r
+=
stats_top_txt
(
r
,
100
);
break
;
case
TASK_STATS_EVERYTHING
:
r
+=
stats_return_everything
(
r
);
break
;
#ifdef WANT_SPOT_WOODPECKER
case
TASK_STATS_WOODPECKERS
:
r
+=
stats_return_woodpeckers
(
r
,
128
);
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录