Skip to content

Commit 6250fd3

Browse files
author
zhengshuxin
committed
acl_master supports signal the children processes with the specified signal numer
1 parent 63c994a commit 6250fd3

File tree

6 files changed

+138
-111
lines changed

6 files changed

+138
-111
lines changed

app/master/daemon/master/master_spawn.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,8 @@ void acl_master_signal_children(ACL_MASTER_SERV *serv, int sig, int *nsignaled)
593593
*nsignaled = n;
594594
}
595595

596-
acl_msg_info("%s: service %s, path %s, signal %d, children %d,"
597-
" signaled %d", myname, serv->name, serv->path,
596+
acl_msg_info("%s: service=%s, path=%s, signal=%d, children=%d,"
597+
" signaled=%d", myname, serv->name, serv->path,
598598
sig, acl_ring_size(&serv->children), n);
599599
}
600600

app/master/daemon/version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define __MASTER_VERSION_INCLUDE_H__
33

44
#define MASTER_NAME "acl_master"
5-
#define MASTER_VERSION "3.5.4-4"
6-
#define MASTER_DATE "20220630"
5+
#define MASTER_VERSION "3.5.4-5"
6+
#define MASTER_DATE "20220704"
77

88
#endif

app/master/doc/protocol.md

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212

1313
请求协议:
1414
```
15-
POST /?cmd=list HTTP/1.0
16-
Content-Length: 25
15+
POST /?cmd=list HTTP/1.1
16+
Host: localhost
17+
Content-Length: 24
1718
Connection: keep-alive
1819
Content-Type: text/json
1920
20-
{ cmd: 'list', data: {}}
21+
{"cmd":"list","data":{}}
2122
```
2223

2324
响应协议:
@@ -26,7 +27,7 @@ HTTP/1.1 200 OK
2627
Date: Tue, 19 Sep 2017 06:51:50 GMT
2728
Server: acl
2829
Content-Type: text/json; charset=utf-8
29-
Content-Length: 1588
30+
Content-Length: 552
3031
Connection: Keep-Alive
3132
3233
{"status":200,"msg":"ok","data":[{"status":200,"name":"*.*.*.*:53","type":5,"start":0,"owner":"","path":"/opt/soft/acl-master/libexec/udp-echo","conf":"/opt/soft/acl-master/conf/service/udp-echo.cf","proc_max":1,"proc_prefork":1,"proc_total":1,"proc_avail":1,"throttle_delay":6,"listen_fd_count":0,"notify_addr":"","notify_recipients":"","env":[{"LOG":"/opt/soft/acl-master/var/log/udp-echo"},{"MASTER_LOG":"/opt/soft/acl-master/var/log/acl_master"},{"SERVICE_LOG":"/opt/soft/acl-master/var/log/udp-echo"}],"procs":[{"pid":26036,"start":1505803886}]}]}
@@ -36,12 +37,13 @@ Connection: Keep-Alive
3637

3738
请求协议
3839
```
39-
POST /?cmd=stat HTTP/1.0
40-
Content-Length: 81
40+
POST /?cmd=stat HTTP/1.1
41+
Host: localhost
42+
Content-Length: 80
4143
Connection: keep-alive
4244
Content-Type: text/json
4345
44-
{ cmd: 'stat', data: [{'path':'/opt/soft/acl-master/conf/service/udp-echo.cf'}]}
46+
{"cmd":"stat","data":[{"path":"/opt/soft/acl-master/conf/service/udp-echo.cf"}]}
4547
```
4648

4749
响应协议
@@ -60,12 +62,13 @@ Connection: Keep-Alive
6062

6163
请求协议
6264
```
63-
POST /?cmd=stop HTTP/1.0
64-
Content-Length: 81
65+
POST /?cmd=stop HTTP/1.1
66+
Host: localhost
67+
Content-Length: 80
6568
Connection: keep-alive
6669
Content-Type: text/json
6770
68-
{ cmd: 'stop', data: [{'path':'/opt/soft/acl-master/conf/service/udp-echo.cf'}]}
71+
{"cmd":"stop","data":[{"path":"/opt/soft/acl-master/conf/service/udp-echo.cf"}]}
6972
```
7073

7174
响应协议
@@ -84,12 +87,13 @@ Connection: Keep-Alive
8487

8588
请求协议
8689
```
87-
POST /?cmd=start HTTP/1.0
88-
Content-Length: 83
90+
POST /?cmd=start HTTP/1.1
91+
Host: localhost
92+
Content-Length: 81
8993
Connection: keep-alive
9094
Content-Type: text/json
9195
92-
{ cmd: 'start', data: [{'path':'/opt/soft/acl-master/conf/service/udp-echo.cf'}]}
96+
{"cmd":"start","data":[{"path":"/opt/soft/acl-master/conf/service/udp-echo.cf"}]}
9397
```
9498

9599
响应协议
@@ -108,12 +112,13 @@ Connection: Keep-Alive
108112

109113
请求协议
110114
```
111-
POST /?cmd=reload HTTP/1.0
112-
Content-Length: 84
115+
POST /?cmd=reload HTTP/1.1
116+
Host: localhost
117+
Content-Length: 82
113118
Connection: keep-alive
114119
Content-Type: text/json
115120
116-
{ cmd: 'reload', data: [{'path':'/opt/soft/acl-master/conf/service/udp-echo.cf'}]}
121+
{"cmd":"reload","data":[{"path":"/opt/soft/acl-master/conf/service/udp-echo.cf"}]}
117122
```
118123

119124
响应协议
@@ -127,3 +132,16 @@ Connection: Keep-Alive
127132
128133
{"status":200,"msg":"ok","data":[{"status":200,"proc_count":1,"proc_signaled":1,"path":"/opt/soft/acl-master/conf/service/udp-echo.cf"}]}
129134
```
135+
136+
### 6. 给指定服务的进程发送指定信号
137+
138+
请求协议
139+
```
140+
POST /?cmd=signal HTTP/1.1
141+
Host: localhost
142+
Content-Length: 96
143+
Connection: keep-alive
144+
Content-Type: text/json
145+
146+
{"cmd":"signal","signum":"SIGUSR1","data":[{"path":"/opt/soft/acl-master/conf/service/mf.cf"}]}}
147+
```

app/master/tools/master_ctl/http_request.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,20 @@ bool http_request(const char* addr, TReq& req, TRes& res)
1212
conn.request_header().set_url(url).set_keep_alive(false)
1313
.set_content_type("text/json");
1414

15-
if (conn.request(body, body.size()) == false)
16-
{
15+
if (!conn.request(body, body.size())) {
1716
printf("request error, json=[%s]\r\n", body.c_str());
1817
return false;
1918
}
2019

20+
//printf("body=%s\n", body.c_str());
21+
2122
acl::json json;
22-
if (conn.get_body(json) == false)
23-
{
23+
if (!conn.get_body(json)) {
2424
printf("get_body error, json=[%s]\r\n", body.c_str());
2525
return false;
2626
}
2727

28-
if (deserialize<TRes>(json, res) == false)
29-
{
28+
if (!deserialize<TRes>(json, res)) {
3029
printf("deserialize error, req json=[%s]\r\n", body.c_str());
3130
return false;
3231
}

0 commit comments

Comments
 (0)