winlin

for #319, api raw update global.listen

@@ -44,87 +44,69 @@ stream_caster { @@ -44,87 +44,69 @@ stream_caster {
44 rtp_port_min 57200; 44 rtp_port_min 57200;
45 rtp_port_max 57300; 45 rtp_port_max 57300;
46 } 46 }
47 -vhost __defaultVhost__ {  
48 -} 47 +vhost __defaultVhost__;
49 vhost vhost.srs.com { 48 vhost vhost.srs.com {
50 enabled off; 49 enabled off;
51 chunk_size 128; 50 chunk_size 128;
52 tcp_nodelay on; 51 tcp_nodelay on;
53 min_latency on; 52 min_latency on;
54 -  
55 cluster { 53 cluster {
56 mode remote; 54 mode remote;
57 origin 127.0.0.1:1935 localhost:1935; 55 origin 127.0.0.1:1935 localhost:1935;
58 -  
59 token_traverse off; 56 token_traverse off;
60 vhost same.edge.srs.com; 57 vhost same.edge.srs.com;
61 -  
62 debug_srs_upnode off; 58 debug_srs_upnode off;
63 } 59 }
64 -  
65 forward { 60 forward {
66 enabled off; 61 enabled off;
67 destination 127.0.0.1:1936 127.0.0.1:1937; 62 destination 127.0.0.1:1936 127.0.0.1:1937;
68 } 63 }
69 -  
70 play { 64 play {
71 time_jitter full; 65 time_jitter full;
72 mix_correct off; 66 mix_correct off;
73 -  
74 atc off; 67 atc off;
75 atc_auto off; 68 atc_auto off;
76 -  
77 mw_latency 100; 69 mw_latency 100;
78 -  
79 gop_cache off; 70 gop_cache off;
80 queue_length 10; 71 queue_length 10;
81 -  
82 send_min_interval 10.0; 72 send_min_interval 10.0;
83 reduce_sequence_header on; 73 reduce_sequence_header on;
84 } 74 }
85 -  
86 publish { 75 publish {
87 mr off; 76 mr off;
88 mr_latency 350; 77 mr_latency 350;
89 -  
90 firstpkt_timeout 20000; 78 firstpkt_timeout 20000;
91 normal_timeout 7000; 79 normal_timeout 7000;
92 } 80 }
93 -  
94 refer { 81 refer {
95 enabled off; 82 enabled off;
96 all github.com github.io; 83 all github.com github.io;
97 publish github.com github.io; 84 publish github.com github.io;
98 play github.com github.io; 85 play github.com github.io;
99 } 86 }
100 -  
101 bandcheck { 87 bandcheck {
102 enabled off; 88 enabled off;
103 key 35c9b402c12a7246868752e2878f7e0e; 89 key 35c9b402c12a7246868752e2878f7e0e;
104 interval 30; 90 interval 30;
105 limit_kbps 4000; 91 limit_kbps 4000;
106 } 92 }
107 -  
108 security { 93 security {
109 enabled off; 94 enabled off;
110 allow play all; 95 allow play all;
111 allow publish all; 96 allow publish all;
112 deny publish all; 97 deny publish all;
113 } 98 }
114 -  
115 http_static { 99 http_static {
116 enabled off; 100 enabled off;
117 mount [vhost]/hls; 101 mount [vhost]/hls;
118 dir ./objs/nginx/html/hls; 102 dir ./objs/nginx/html/hls;
119 } 103 }
120 -  
121 http_remux { 104 http_remux {
122 enabled off; 105 enabled off;
123 fast_cache 30; 106 fast_cache 30;
124 mount [vhost]/[app]/[stream].flv; 107 mount [vhost]/[app]/[stream].flv;
125 hstrs on; 108 hstrs on;
126 } 109 }
127 -  
128 http_hooks { 110 http_hooks {
129 enabled off; 111 enabled off;
130 on_connect http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients; 112 on_connect http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients;
@@ -137,12 +119,10 @@ vhost vhost.srs.com { @@ -137,12 +119,10 @@ vhost vhost.srs.com {
137 on_hls http://127.0.0.1:8085/api/v1/hls http://localhost:8085/api/v1/hls; 119 on_hls http://127.0.0.1:8085/api/v1/hls http://localhost:8085/api/v1/hls;
138 on_hls_notify http://127.0.0.1:8085/api/v1/hls/[app]/[stream][ts_url]; 120 on_hls_notify http://127.0.0.1:8085/api/v1/hls/[app]/[stream][ts_url];
139 } 121 }
140 -  
141 exec { 122 exec {
142 enabled off; 123 enabled off;
143 publish ./objs/ffmpeg/bin/ffmpeg -f flv -i [url] -c copy -y ./[stream].flv; 124 publish ./objs/ffmpeg/bin/ffmpeg -f flv -i [url] -c copy -y ./[stream].flv;
144 } 125 }
145 -  
146 hls { 126 hls {
147 enabled off; 127 enabled off;
148 hls_fragment 10; 128 hls_fragment 10;
@@ -164,14 +144,12 @@ vhost vhost.srs.com { @@ -164,14 +144,12 @@ vhost vhost.srs.com {
164 hls_nb_notify 64; 144 hls_nb_notify 64;
165 hls_wait_keyframe on; 145 hls_wait_keyframe on;
166 } 146 }
167 -  
168 hds { 147 hds {
169 enabled off; 148 enabled off;
170 hds_fragment 10; 149 hds_fragment 10;
171 hds_window 60; 150 hds_window 60;
172 hds_path ./objs/nginx/html; 151 hds_path ./objs/nginx/html;
173 } 152 }
174 -  
175 dvr { 153 dvr {
176 enabled off; 154 enabled off;
177 dvr_plan session; 155 dvr_plan session;
@@ -180,7 +158,6 @@ vhost vhost.srs.com { @@ -180,7 +158,6 @@ vhost vhost.srs.com {
180 dvr_wait_keyframe on; 158 dvr_wait_keyframe on;
181 time_jitter full; 159 time_jitter full;
182 } 160 }
183 -  
184 ingest livestream { 161 ingest livestream {
185 enabled off; 162 enabled off;
186 input { 163 input {
@@ -221,7 +198,6 @@ vhost vhost.srs.com { @@ -221,7 +198,6 @@ vhost vhost.srs.com {
221 output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]; 198 output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream];
222 } 199 }
223 } 200 }
224 -  
225 transcode live { 201 transcode live {
226 enabled off; 202 enabled off;
227 ffmpeg ./objs/ffmpeg/bin/ffmpeg; 203 ffmpeg ./objs/ffmpeg/bin/ffmpeg;
@@ -258,7 +234,6 @@ vhost vhost.srs.com { @@ -258,7 +234,6 @@ vhost vhost.srs.com {
258 output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; 234 output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
259 } 235 }
260 } 236 }
261 -  
262 transcode { 237 transcode {
263 enabled off; 238 enabled off;
264 ffmpeg ./objs/ffmpeg/bin/ffmpeg; 239 ffmpeg ./objs/ffmpeg/bin/ffmpeg;
@@ -2182,6 +2182,17 @@ int SrsConfig::raw_set_listen(const vector<string>& eps) @@ -2182,6 +2182,17 @@ int SrsConfig::raw_set_listen(const vector<string>& eps)
2182 SrsConfDirective* listen = root->get("listen"); 2182 SrsConfDirective* listen = root->get("listen");
2183 listen->args = eps; 2183 listen->args = eps;
2184 2184
  2185 + // force to reload the memory server.
  2186 + vector<ISrsReloadHandler*>::iterator it;
  2187 + for (it = subscribes.begin(); it != subscribes.end(); ++it) {
  2188 + ISrsReloadHandler* subscribe = *it;
  2189 + if ((ret = subscribe->on_reload_listen()) != ERROR_SUCCESS) {
  2190 + srs_error("notify subscribes reload listen failed. ret=%d", ret);
  2191 + return ret;
  2192 + }
  2193 + }
  2194 + srs_trace("reload listen success.");
  2195 +
2185 return ret; 2196 return ret;
2186 } 2197 }
2187 2198
@@ -1016,7 +1016,6 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) @@ -1016,7 +1016,6 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
1016 } 1016 }
1017 } 1017 }
1018 1018
1019 - server->on_signal(SRS_SIGNAL_RELOAD);  
1020 server->on_signal(SRS_SIGNAL_PERSISTENCE_CONFIG); 1019 server->on_signal(SRS_SIGNAL_PERSISTENCE_CONFIG);
1021 srs_trace("raw api update %s=%s ok.", scope.c_str(), value.c_str()); 1020 srs_trace("raw api update %s=%s ok.", scope.c_str(), value.c_str());
1022 1021