Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
accel-ppp
提交
ecee62f2
A
accel-ppp
项目概览
Achou.Wang
/
accel-ppp
通知
6
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
accel-ppp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
ecee62f2
编写于
3月 18, 2016
作者:
D
Dmitry Kozlov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make termination caused by SIGTERM soft
上级
862f1cbf
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
30 addition
and
8 deletion
+30
-8
accel-pppd/cli/std_cmd.c
accel-pppd/cli/std_cmd.c
+3
-3
accel-pppd/ctrl/ipoe/ipoe.c
accel-pppd/ctrl/ipoe/ipoe.c
+2
-2
accel-pppd/include/ap_session.h
accel-pppd/include/ap_session.h
+1
-1
accel-pppd/main.c
accel-pppd/main.c
+5
-1
accel-pppd/session.c
accel-pppd/session.c
+19
-1
未找到文件。
accel-pppd/cli/std_cmd.c
浏览文件 @
ecee62f2
...
@@ -292,7 +292,7 @@ static int shutdown_exec(const char *cmd, char * const *f, int f_cnt, void *cli)
...
@@ -292,7 +292,7 @@ static int shutdown_exec(const char *cmd, char * const *f, int f_cnt, void *cli)
if
(
f_cnt
==
2
)
{
if
(
f_cnt
==
2
)
{
if
(
!
strcmp
(
f
[
1
],
"soft"
))
{
if
(
!
strcmp
(
f
[
1
],
"soft"
))
{
ap_shutdown_soft
(
NULL
);
ap_shutdown_soft
(
NULL
,
0
);
return
CLI_CMD_OK
;
return
CLI_CMD_OK
;
}
else
if
(
!
strcmp
(
f
[
1
],
"hard"
))
}
else
if
(
!
strcmp
(
f
[
1
],
"hard"
))
hard
=
1
;
hard
=
1
;
...
@@ -303,7 +303,7 @@ static int shutdown_exec(const char *cmd, char * const *f, int f_cnt, void *cli)
...
@@ -303,7 +303,7 @@ static int shutdown_exec(const char *cmd, char * const *f, int f_cnt, void *cli)
return
CLI_CMD_SYNTAX
;
return
CLI_CMD_SYNTAX
;
}
}
ap_shutdown_soft
(
NULL
);
ap_shutdown_soft
(
NULL
,
0
);
terminate_all_sessions
(
hard
);
terminate_all_sessions
(
hard
);
...
@@ -370,7 +370,7 @@ static int restart_exec(const char *cmd, char * const *f, int f_cnt, void *cli)
...
@@ -370,7 +370,7 @@ static int restart_exec(const char *cmd, char * const *f, int f_cnt, void *cli)
else
else
return
CLI_CMD_SYNTAX
;
return
CLI_CMD_SYNTAX
;
ap_shutdown_soft
(
restart
);
ap_shutdown_soft
(
restart
,
0
);
terminate_all_sessions
(
0
);
terminate_all_sessions
(
0
);
return
CLI_CMD_OK
;
return
CLI_CMD_OK
;
...
...
accel-pppd/ctrl/ipoe/ipoe.c
浏览文件 @
ecee62f2
...
@@ -1097,7 +1097,7 @@ static int ipoe_session_terminate(struct ap_session *s, int hard)
...
@@ -1097,7 +1097,7 @@ static int ipoe_session_terminate(struct ap_session *s, int hard)
{
{
struct
ipoe_session
*
ses
=
container_of
(
s
,
typeof
(
*
ses
),
ses
);
struct
ipoe_session
*
ses
=
container_of
(
s
,
typeof
(
*
ses
),
ses
);
if
(
hard
||
!
conf_soft_terminate
||
ses
->
UP
)
if
(
hard
||
!
conf_soft_terminate
||
ses
->
UP
||
ap_shutdown
)
ipoe_session_terminated
(
ses
);
ipoe_session_terminated
(
ses
);
else
else
ses
->
terminate
=
1
;
ses
->
terminate
=
1
;
...
@@ -2068,8 +2068,8 @@ static void ipoe_serv_close(struct triton_context_t *ctx)
...
@@ -2068,8 +2068,8 @@ static void ipoe_serv_close(struct triton_context_t *ctx)
struct
ipoe_serv
*
serv
=
container_of
(
ctx
,
typeof
(
*
serv
),
ctx
);
struct
ipoe_serv
*
serv
=
container_of
(
ctx
,
typeof
(
*
serv
),
ctx
);
pthread_mutex_lock
(
&
serv
->
lock
);
pthread_mutex_lock
(
&
serv
->
lock
);
if
(
!
list_empty
(
&
serv
->
sessions
))
{
serv
->
need_close
=
1
;
serv
->
need_close
=
1
;
if
(
!
list_empty
(
&
serv
->
sessions
))
{
pthread_mutex_unlock
(
&
serv
->
lock
);
pthread_mutex_unlock
(
&
serv
->
lock
);
return
;
return
;
}
}
...
...
accel-pppd/include/ap_session.h
浏览文件 @
ecee62f2
...
@@ -147,6 +147,6 @@ int ap_session_rename(struct ap_session *ses, const char *ifname, int len);
...
@@ -147,6 +147,6 @@ int ap_session_rename(struct ap_session *ses, const char *ifname, int len);
int
ap_session_read_stats
(
struct
ap_session
*
ses
,
struct
rtnl_link_stats
*
stats
);
int
ap_session_read_stats
(
struct
ap_session
*
ses
,
struct
rtnl_link_stats
*
stats
);
void
ap_shutdown_soft
(
void
(
*
cb
)(
void
)
);
int
ap_shutdown_soft
(
void
(
*
cb
)(
void
),
int
term
);
#endif
#endif
accel-pppd/main.c
浏览文件 @
ecee62f2
...
@@ -21,10 +21,11 @@
...
@@ -21,10 +21,11 @@
#include "triton/triton.h"
#include "triton/triton.h"
#include "memdebug.h"
#include "log.h"
#include "log.h"
#include "events.h"
#include "events.h"
#include "ap_session.h"
#include "backup.h"
#include "backup.h"
#include "memdebug.h"
#ifndef ARG_MAX
#ifndef ARG_MAX
#define ARG_MAX 128*1024
#define ARG_MAX 128*1024
...
@@ -335,6 +336,9 @@ int main(int _argc, char **_argv)
...
@@ -335,6 +336,9 @@ int main(int _argc, char **_argv)
sigwait
(
&
set
,
&
sig
);
sigwait
(
&
set
,
&
sig
);
log_info1
(
"terminate, sig = %i
\n
"
,
sig
);
log_info1
(
"terminate, sig = %i
\n
"
,
sig
);
if
(
ap_shutdown_soft
(
NULL
,
1
)
==
0
)
sigwait
(
&
set
,
&
sig
);
triton_terminate
();
triton_terminate
();
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
...
...
accel-pppd/session.c
浏览文件 @
ecee62f2
...
@@ -292,17 +292,35 @@ void __export ap_session_terminate(struct ap_session *ses, int cause, int hard)
...
@@ -292,17 +292,35 @@ void __export ap_session_terminate(struct ap_session *ses, int cause, int hard)
}
}
}
}
void
ap_shutdown_soft
(
void
(
*
cb
)(
void
)
)
static
void
__terminate_soft_reboot
(
struct
ap_session
*
ses
)
{
{
ap_session_terminate
(
ses
,
TERM_NAS_REBOOT
,
0
);
}
int
ap_shutdown_soft
(
void
(
*
cb
)(
void
),
int
term
)
{
struct
ap_session
*
ses
;
ap_shutdown
=
1
;
ap_shutdown
=
1
;
shutdown_cb
=
cb
;
shutdown_cb
=
cb
;
pthread_rwlock_rdlock
(
&
ses_lock
);
if
(
!
ap_session_stat
.
starting
&&
!
ap_session_stat
.
active
&&
!
ap_session_stat
.
finishing
)
{
if
(
!
ap_session_stat
.
starting
&&
!
ap_session_stat
.
active
&&
!
ap_session_stat
.
finishing
)
{
pthread_rwlock_unlock
(
&
ses_lock
);
if
(
shutdown_cb
)
if
(
shutdown_cb
)
shutdown_cb
();
shutdown_cb
();
else
else
kill
(
getpid
(),
SIGTERM
);
kill
(
getpid
(),
SIGTERM
);
return
1
;
}
else
if
(
term
)
{
list_for_each_entry
(
ses
,
&
ses_list
,
entry
)
triton_context_call
(
ses
->
ctrl
->
ctx
,
(
triton_event_func
)
__terminate_soft_reboot
,
ses
);
}
}
pthread_rwlock_unlock
(
&
ses_lock
);
return
0
;
}
}
static
void
generate_sessionid
(
struct
ap_session
*
ses
)
static
void
generate_sessionid
(
struct
ap_session
*
ses
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录