Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
NetWork
Opentracker
提交
8acc0ff4
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,发现更多精彩内容 >>
提交
8acc0ff4
编写于
11月 02, 2007
作者:
E
erdgeist
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Introduce configuration dependent number of parameters in a nicer way
上级
5aa41e9d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
35 deletion
+17
-35
opentracker.c
opentracker.c
+9
-25
trackerlogic.c
trackerlogic.c
+1
-5
trackerlogic.h
trackerlogic.h
+7
-5
未找到文件。
opentracker.c
浏览文件 @
8acc0ff4
...
...
@@ -76,6 +76,9 @@ static size_t ot_sockets_count = 0;
#ifdef _DEBUG_HTTPERROR
static
char
debug_request
[
8192
];
#define _DEBUG_HTTPERROR_PARAM( param ) , param
#else
#define _DEBUG_HTTPERROR_PARAM( param )
#endif
typedef
enum
{
...
...
@@ -99,12 +102,7 @@ static int ot_ip_compare( const void *a, const void *b ) { return memcmp( a,b,4
int
main
(
int
argc
,
char
**
argv
);
static
void
httperror
(
const
int64
s
,
const
char
*
title
,
const
char
*
message
);
#ifdef _DEBUG_HTTPERROR
static
void
httpresponse
(
const
int64
s
,
char
*
data
,
size_t
l
);
#else
static
void
httpresponse
(
const
int64
s
,
char
*
data
);
#endif
static
void
httpresponse
(
const
int64
s
,
char
*
data
_DEBUG_HTTPERROR_PARAM
(
size_t
l
)
);
static
void
sendmmapdata
(
const
int64
s
,
char
*
buffer
,
const
size_t
size
);
static
void
senddata
(
const
int64
s
,
char
*
buffer
,
const
size_t
size
);
...
...
@@ -226,11 +224,7 @@ static void senddata( const int64 s, char *buffer, size_t size ) {
}
}
#ifdef _DEBUG_HTTPERROR
static
void
httpresponse
(
const
int64
s
,
char
*
data
,
size_t
l
)
{
#else
static
void
httpresponse
(
const
int64
s
,
char
*
data
)
{
#endif
static
void
httpresponse
(
const
int64
s
,
char
*
data
_DEBUG_HTTPERROR_PARAM
(
size_t
l
)
)
{
struct
http_data
*
h
=
io_getcookie
(
s
);
char
*
c
,
*
reply
;
ot_peer
peer
;
...
...
@@ -675,13 +669,8 @@ static void handle_read( const int64 clientsocket ) {
/* If we get the whole request in one packet, handle it without copying */
if
(
!
array_start
(
&
h
->
request
)
)
{
if
(
memchr
(
static_inbuf
,
'\n'
,
l
)
)
{
return
httpresponse
(
clientsocket
,
static_inbuf
#ifdef _DEBUG_HTTPERROR
,
l
#endif
);
}
if
(
memchr
(
static_inbuf
,
'\n'
,
l
)
)
return
httpresponse
(
clientsocket
,
static_inbuf
_DEBUG_HTTPERROR_PARAM
(
l
)
);
h
->
flag
|=
STRUCT_HTTP_FLAG_ARRAY_USED
;
return
array_catb
(
&
h
->
request
,
static_inbuf
,
l
);
}
...
...
@@ -695,13 +684,8 @@ static void handle_read( const int64 clientsocket ) {
if
(
(
array_bytes
(
&
h
->
request
)
>
8192
)
&&
NOTBLESSED
(
h
)
)
return
httperror
(
clientsocket
,
"500 request too long"
,
"You sent too much headers"
);
if
(
memchr
(
array_start
(
&
h
->
request
),
'\n'
,
array_bytes
(
&
h
->
request
)
)
)
{
return
httpresponse
(
clientsocket
,
array_start
(
&
h
->
request
)
#ifdef _DEBUG_HTTPERROR
,
array_bytes
(
&
h
->
request
)
#endif
);
}
if
(
memchr
(
array_start
(
&
h
->
request
),
'\n'
,
array_bytes
(
&
h
->
request
)
)
)
return
httpresponse
(
clientsocket
,
array_start
(
&
h
->
request
)
_DEBUG_HTTPERROR_PARAM
(
array_bytes
(
&
h
->
request
)
)
);
}
static
void
handle_write
(
const
int64
clientsocket
)
{
...
...
trackerlogic.c
浏览文件 @
8acc0ff4
...
...
@@ -145,11 +145,7 @@ static void vector_remove_torrent( ot_vector *vector, ot_torrent *match ) {
}
}
#ifdef WANT_TRACKER_SYNC
ot_torrent
*
add_peer_to_torrent
(
ot_hash
*
hash
,
ot_peer
*
peer
,
int
from_changeset
)
{
#else
ot_torrent
*
add_peer_to_torrent
(
ot_hash
*
hash
,
ot_peer
*
peer
)
{
#endif
ot_torrent
*
add_peer_to_torrent
(
ot_hash
*
hash
,
ot_peer
*
peer
WANT_TRACKER_SYNC_PARAM
(
int
from_changeset
)
)
{
int
exactmatch
;
ot_torrent
*
torrent
;
ot_peer
*
peer_dest
;
...
...
trackerlogic.h
浏览文件 @
8acc0ff4
...
...
@@ -98,16 +98,18 @@ typedef struct {
Exported functions
*/
#ifdef WANT_TRACKER_SYNC
#define WANT_TRACKER_SYNC_PARAM( param ) , param
#else
#define WANT_TRACKER_SYNC_PARAM( param )
#endif
int
init_logic
(
const
char
*
const
serverdir
);
void
deinit_logic
(
void
);
enum
{
STATS_MRTG
,
STATS_TOP5
,
STATS_DMEM
,
STATS_TCP
,
STATS_UDP
,
STATS_SLASH24S
,
STATS_SLASH24S_OLD
,
SYNC_IN
,
SYNC_OUT
,
STATS_FULLSCRAPE
};
#ifdef WANT_TRACKER_SYNC
ot_torrent
*
add_peer_to_torrent
(
ot_hash
*
hash
,
ot_peer
*
peer
,
int
from_changeset
);
#else
ot_torrent
*
add_peer_to_torrent
(
ot_hash
*
hash
,
ot_peer
*
peer
);
#endif
ot_torrent
*
add_peer_to_torrent
(
ot_hash
*
hash
,
ot_peer
*
peer
WANT_TRACKER_SYNC_PARAM
(
int
from_changeset
)
);
size_t
remove_peer_from_torrent
(
ot_hash
*
hash
,
ot_peer
*
peer
,
char
*
reply
,
int
is_tcp
);
size_t
return_peers_for_torrent
(
ot_torrent
*
torrent
,
size_t
amount
,
char
*
reply
,
int
is_tcp
);
size_t
return_fullscrape_for_tracker
(
char
**
reply
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录