winlin

fix #503, disable utilities when reload a source. 2.0.233

@@ -346,6 +346,7 @@ Remark: @@ -346,6 +346,7 @@ Remark:
346 346
347 ## History 347 ## History
348 348
  349 +* v2.0, 2017-02-09, fix [#503][bug #503] disable utilities when reload a source. 2.0.233
349 * v2.0, 2017-01-22, for [#752][bug #752] release the io then free it for kbps. 2.0.232 350 * v2.0, 2017-01-22, for [#752][bug #752] release the io then free it for kbps. 2.0.232
350 * v2.0, 2017-01-18, fix [#750][bug #750] use specific error code for dns resolve. 2.0.231 351 * v2.0, 2017-01-18, fix [#750][bug #750] use specific error code for dns resolve. 2.0.231
351 * <strong>v2.0, 2017-01-18, [2.0 beta4(2.0.230)][r2.0b4] released. 86334 lines.</strong> 352 * <strong>v2.0, 2017-01-18, [2.0 beta4(2.0.230)][r2.0b4] released. 86334 lines.</strong>
@@ -1285,6 +1286,7 @@ Winlin @@ -1285,6 +1286,7 @@ Winlin
1285 [bug #749]: https://github.com/ossrs/srs/issues/749 1286 [bug #749]: https://github.com/ossrs/srs/issues/749
1286 [bug #750]: https://github.com/ossrs/srs/issues/750 1287 [bug #750]: https://github.com/ossrs/srs/issues/750
1287 [bug #752]: https://github.com/ossrs/srs/issues/752 1288 [bug #752]: https://github.com/ossrs/srs/issues/752
  1289 +[bug #503]: https://github.com/ossrs/srs/issues/503
1288 [bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx 1290 [bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
1289 1291
1290 [exo #828]: https://github.com/google/ExoPlayer/pull/828 1292 [exo #828]: https://github.com/google/ExoPlayer/pull/828
@@ -1227,6 +1227,12 @@ int SrsSource::on_reload_vhost_forward(string vhost) @@ -1227,6 +1227,12 @@ int SrsSource::on_reload_vhost_forward(string vhost)
1227 1227
1228 // forwarders 1228 // forwarders
1229 destroy_forwarders(); 1229 destroy_forwarders();
  1230 +
  1231 + // Don't start forwarders when source is not active.
  1232 + if (_can_publish) {
  1233 + return ret;
  1234 + }
  1235 +
1230 if ((ret = create_forwarders()) != ERROR_SUCCESS) { 1236 if ((ret = create_forwarders()) != ERROR_SUCCESS) {
1231 srs_error("create forwarders failed. ret=%d", ret); 1237 srs_error("create forwarders failed. ret=%d", ret);
1232 return ret; 1238 return ret;
@@ -1247,6 +1253,12 @@ int SrsSource::on_reload_vhost_hls(string vhost) @@ -1247,6 +1253,12 @@ int SrsSource::on_reload_vhost_hls(string vhost)
1247 1253
1248 #ifdef SRS_AUTO_HLS 1254 #ifdef SRS_AUTO_HLS
1249 hls->on_unpublish(); 1255 hls->on_unpublish();
  1256 +
  1257 + // Don't start forwarders when source is not active.
  1258 + if (_can_publish) {
  1259 + return ret;
  1260 + }
  1261 +
1250 if ((ret = hls->on_publish(_req, true)) != ERROR_SUCCESS) { 1262 if ((ret = hls->on_publish(_req, true)) != ERROR_SUCCESS) {
1251 srs_error("hls publish failed. ret=%d", ret); 1263 srs_error("hls publish failed. ret=%d", ret);
1252 return ret; 1264 return ret;
@@ -1267,6 +1279,12 @@ int SrsSource::on_reload_vhost_hds(string vhost) @@ -1267,6 +1279,12 @@ int SrsSource::on_reload_vhost_hds(string vhost)
1267 1279
1268 #ifdef SRS_AUTO_HDS 1280 #ifdef SRS_AUTO_HDS
1269 hds->on_unpublish(); 1281 hds->on_unpublish();
  1282 +
  1283 + // Don't start forwarders when source is not active.
  1284 + if (_can_publish) {
  1285 + return ret;
  1286 + }
  1287 +
1270 if ((ret = hds->on_publish(_req)) != ERROR_SUCCESS) { 1288 if ((ret = hds->on_publish(_req)) != ERROR_SUCCESS) {
1271 srs_error("hds publish failed. ret=%d", ret); 1289 srs_error("hds publish failed. ret=%d", ret);
1272 return ret; 1290 return ret;
@@ -1288,7 +1306,12 @@ int SrsSource::on_reload_vhost_dvr(string vhost) @@ -1288,7 +1306,12 @@ int SrsSource::on_reload_vhost_dvr(string vhost)
1288 #ifdef SRS_AUTO_DVR 1306 #ifdef SRS_AUTO_DVR
1289 // cleanup dvr 1307 // cleanup dvr
1290 dvr->on_unpublish(); 1308 dvr->on_unpublish();
1291 - 1309 +
  1310 + // Don't start forwarders when source is not active.
  1311 + if (_can_publish) {
  1312 + return ret;
  1313 + }
  1314 +
1292 // reinitialize the dvr, update plan. 1315 // reinitialize the dvr, update plan.
1293 if ((ret = dvr->initialize(this, _req)) != ERROR_SUCCESS) { 1316 if ((ret = dvr->initialize(this, _req)) != ERROR_SUCCESS) {
1294 return ret; 1317 return ret;
@@ -1316,6 +1339,12 @@ int SrsSource::on_reload_vhost_transcode(string vhost) @@ -1316,6 +1339,12 @@ int SrsSource::on_reload_vhost_transcode(string vhost)
1316 1339
1317 #ifdef SRS_AUTO_TRANSCODE 1340 #ifdef SRS_AUTO_TRANSCODE
1318 encoder->on_unpublish(); 1341 encoder->on_unpublish();
  1342 +
  1343 + // Don't start forwarders when source is not active.
  1344 + if (_can_publish) {
  1345 + return ret;
  1346 + }
  1347 +
1319 if ((ret = encoder->on_publish(_req)) != ERROR_SUCCESS) { 1348 if ((ret = encoder->on_publish(_req)) != ERROR_SUCCESS) {
1320 srs_error("start encoder failed. ret=%d", ret); 1349 srs_error("start encoder failed. ret=%d", ret);
1321 return ret; 1350 return ret;
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR 2 32 #define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 232 34 +#define VERSION_REVISION 233
35 35
36 // generated by configure, only macros. 36 // generated by configure, only macros.
37 #include <srs_auto_headers.hpp> 37 #include <srs_auto_headers.hpp>