Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
NetWork
Opentracker
提交
e65ac51a
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,发现更多精彩内容 >>
提交
e65ac51a
编写于
11月 21, 2007
作者:
E
erdgeist
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Last user of sendmmapdata is gone. Purge it.
上级
e9d49af9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
46 deletion
+11
-46
opentracker.c
opentracker.c
+11
-46
未找到文件。
opentracker.c
浏览文件 @
e65ac51a
...
...
@@ -8,7 +8,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/mman.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdlib.h>
...
...
@@ -62,8 +61,8 @@ time_t g_now;
#endif
/* To always have space for error messages ;) */
char
static_inbuf
[
8192
];
char
static_outbuf
[
8192
];
static
char
static_inbuf
[
8192
];
static
char
static_outbuf
[
8192
];
#define OT_MAXMULTISCRAPE_COUNT 64
static
ot_hash
multiscrape_buf
[
OT_MAXMULTISCRAPE_COUNT
];
...
...
@@ -103,7 +102,6 @@ int main( int argc, char **argv );
static
void
httperror
(
const
int64
s
,
const
char
*
title
,
const
char
*
message
);
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
sendiovecdata
(
const
int64
s
,
int
iovec_entries
,
struct
iovec
*
iovector
);
static
void
senddata
(
const
int64
s
,
char
*
buffer
,
const
size_t
size
);
...
...
@@ -152,42 +150,6 @@ static void httperror( const int64 s, const char *title, const char *message ) {
senddata
(
s
,
static_outbuf
,
reply_size
);
}
static
void
sendmmapdata
(
const
int64
s
,
char
*
buffer
,
size_t
size
)
{
struct
http_data
*
h
=
io_getcookie
(
s
);
char
*
header
;
size_t
header_size
;
tai6464
t
;
if
(
!
h
)
{
munmap
(
buffer
,
size
);
return
;
}
if
(
h
->
flag
&
STRUCT_HTTP_FLAG_ARRAY_USED
)
{
h
->
flag
&=
~
STRUCT_HTTP_FLAG_ARRAY_USED
;
array_reset
(
&
h
->
request
);
}
header
=
malloc
(
SUCCESS_HTTP_HEADER_LENGTH
);
if
(
!
header
)
{
munmap
(
buffer
,
size
);
HTTPERROR_500
;
}
header_size
=
sprintf
(
header
,
"HTTP/1.0 200 OK
\r\n
Content-Type: text/plain
\r\n
Content-Length: %zd
\r\n\r\n
"
,
size
);
iob_reset
(
&
h
->
batch
);
iob_addbuf_free
(
&
h
->
batch
,
header
,
header_size
);
iob_addbuf_munmap
(
&
h
->
batch
,
buffer
,
size
);
h
->
flag
|=
STRUCT_HTTP_FLAG_IOB_USED
;
/* writeable sockets timeout after twice the pool timeout
which defaults to 5 minutes (e.g. after 10 minutes) */
taia_now
(
&
t
);
taia_addsec
(
&
t
,
&
t
,
OT_CLIENT_TIMEOUT_SEND
);
io_timeout
(
s
,
t
);
io_dontwantread
(
s
);
io_wantwrite
(
s
);
}
static
void
sendiovecdata
(
const
int64
s
,
int
iovec_entries
,
struct
iovec
*
iovector
)
{
struct
http_data
*
h
=
io_getcookie
(
s
);
char
*
header
;
...
...
@@ -343,9 +305,11 @@ LOG_TO_STDERR( "sync: %d.%d.%d.%d\n", h->ip[0], h->ip[1], h->ip[2], h->ip[3] );
}
if
(
mode
==
SYNC_OUT
)
{
char
*
reply
;
if
(
!
(
reply_size
=
return_changeset_for_tracker
(
&
reply
)
)
)
HTTPERROR_500
;
return
sendmmapdata
(
s
,
reply
,
reply_size
);
/* Pass this task to the worker thread */
h
->
flag
|=
STRUCT_HTTP_FLAG_WAITINGFORTASK
;
sync_deliver
(
s
);
io_dontwantread
(
s
);
return
;
}
/* Simple but proof for now */
...
...
@@ -789,8 +753,8 @@ static void server_mainloop( ) {
}
/* See if we need to move our pools */
if
(
g_now
!=
ot_last_clean_time
)
{
ot_last_clean_time
=
g_now
;
if
(
NOW
!=
ot_last_clean_time
)
{
ot_last_clean_time
=
NOW
;
clean_all_torrents
();
}
}
...
...
@@ -881,7 +845,8 @@ int main( int argc, char **argv ) {
if
(
trackerlogic_init
(
serverdir
)
==
-
1
)
panic
(
"Logic not started"
);
g_now
=
ot_start_time
=
ot_last_clean_time
=
time
(
NULL
);
g_now
=
ot_start_time
=
time
(
NULL
);
ot_last_clean_time
=
NOW
;
alarm
(
5
);
server_mainloop
(
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录