@@ -1195,7 +1195,6 @@ void SrsConfig::unsubscribe(ISrsReloadHandler* handler)
1195
1195
1196
1196
srs_error_t SrsConfig::reload ()
1197
1197
{
1198
- int ret = ERROR_SUCCESS;
1199
1198
srs_error_t err = srs_success;
1200
1199
1201
1200
SrsConfig conf;
@@ -1214,8 +1213,8 @@ srs_error_t SrsConfig::reload()
1214
1213
return srs_error_wrap (err, " check config" );
1215
1214
}
1216
1215
1217
- if ((ret = reload_conf (&conf)) != ERROR_SUCCESS ) {
1218
- return srs_error_new (ret , " reload config" );
1216
+ if ((err = reload_conf (&conf)) != srs_success ) {
1217
+ return srs_error_wrap (err , " reload config" );
1219
1218
}
1220
1219
1221
1220
return err;
@@ -1485,9 +1484,10 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
1485
1484
return ret;
1486
1485
}
1487
1486
1488
- int SrsConfig::reload_conf (SrsConfig* conf)
1487
+ srs_error_t SrsConfig::reload_conf (SrsConfig* conf)
1489
1488
{
1490
1489
int ret = ERROR_SUCCESS;
1490
+ srs_error_t err = srs_success;
1491
1491
1492
1492
SrsConfDirective* old_root = root;
1493
1493
SrsAutoFree (SrsConfDirective, old_root);
@@ -1509,78 +1509,78 @@ int SrsConfig::reload_conf(SrsConfig* conf)
1509
1509
// merge config: listen
1510
1510
if (!srs_directive_equals (root->get (" listen" ), old_root->get (" listen" ))) {
1511
1511
if ((ret = do_reload_listen ()) != ERROR_SUCCESS) {
1512
- return ret;
1512
+ return srs_error_new ( ret, " listen " ) ;
1513
1513
}
1514
1514
}
1515
1515
1516
1516
// merge config: pid
1517
1517
if (!srs_directive_equals (root->get (" pid" ), old_root->get (" pid" ))) {
1518
1518
if ((ret = do_reload_pid ()) != ERROR_SUCCESS) {
1519
- return ret;
1519
+ return srs_error_new ( ret, " pid " ); ;
1520
1520
}
1521
1521
}
1522
1522
1523
1523
// merge config: srs_log_tank
1524
1524
if (!srs_directive_equals (root->get (" srs_log_tank" ), old_root->get (" srs_log_tank" ))) {
1525
1525
if ((ret = do_reload_srs_log_tank ()) != ERROR_SUCCESS) {
1526
- return ret;
1526
+ return srs_error_new ( ret, " log tank " ); ;
1527
1527
}
1528
1528
}
1529
1529
1530
1530
// merge config: srs_log_level
1531
1531
if (!srs_directive_equals (root->get (" srs_log_level" ), old_root->get (" srs_log_level" ))) {
1532
1532
if ((ret = do_reload_srs_log_level ()) != ERROR_SUCCESS) {
1533
- return ret;
1533
+ return srs_error_new ( ret, " log level " ); ;
1534
1534
}
1535
1535
}
1536
1536
1537
1537
// merge config: srs_log_file
1538
1538
if (!srs_directive_equals (root->get (" srs_log_file" ), old_root->get (" srs_log_file" ))) {
1539
1539
if ((ret = do_reload_srs_log_file ()) != ERROR_SUCCESS) {
1540
- return ret;
1540
+ return srs_error_new ( ret, " log file " ); ;
1541
1541
}
1542
1542
}
1543
1543
1544
1544
// merge config: max_connections
1545
1545
if (!srs_directive_equals (root->get (" max_connections" ), old_root->get (" max_connections" ))) {
1546
1546
if ((ret = do_reload_max_connections ()) != ERROR_SUCCESS) {
1547
- return ret;
1547
+ return srs_error_new ( ret, " max connections " ); ;
1548
1548
}
1549
1549
}
1550
1550
1551
1551
// merge config: utc_time
1552
1552
if (!srs_directive_equals (root->get (" utc_time" ), old_root->get (" utc_time" ))) {
1553
- if ((ret = do_reload_utc_time ()) != ERROR_SUCCESS ) {
1554
- return ret ;
1553
+ if ((err = do_reload_utc_time ()) != srs_success ) {
1554
+ return srs_error_wrap (err, " utc time " ); ;
1555
1555
}
1556
1556
}
1557
1557
1558
1558
// merge config: pithy_print_ms
1559
1559
if (!srs_directive_equals (root->get (" pithy_print_ms" ), old_root->get (" pithy_print_ms" ))) {
1560
1560
if ((ret = do_reload_pithy_print_ms ()) != ERROR_SUCCESS) {
1561
- return ret;
1561
+ return srs_error_new ( ret, " pithy print ms " ); ;
1562
1562
}
1563
1563
}
1564
1564
1565
1565
// merge config: http_api
1566
1566
if ((ret = reload_http_api (old_root)) != ERROR_SUCCESS) {
1567
- return ret;
1567
+ return srs_error_new ( ret, " http api " ); ;
1568
1568
}
1569
1569
1570
1570
// merge config: http_stream
1571
1571
if ((ret = reload_http_stream (old_root)) != ERROR_SUCCESS) {
1572
- return ret;
1572
+ return srs_error_new ( ret, " http steram " ); ;
1573
1573
}
1574
1574
1575
1575
// TODO: FIXME: support reload stream_caster.
1576
1576
// TODO: FIXME: support reload kafka.
1577
1577
1578
1578
// merge config: vhost
1579
1579
if ((ret = reload_vhost (old_root)) != ERROR_SUCCESS) {
1580
- return ret;
1580
+ return srs_error_new ( ret, " vhost " ); ;
1581
1581
}
1582
1582
1583
- return ret ;
1583
+ return err ;
1584
1584
}
1585
1585
1586
1586
int SrsConfig::reload_http_api (SrsConfDirective* old_root)
@@ -3015,28 +3015,28 @@ int SrsConfig::raw_set_max_connections(string max_connections, bool& applied)
3015
3015
return ret;
3016
3016
}
3017
3017
3018
- int SrsConfig::raw_set_utc_time (string utc_time, bool & applied)
3018
+ srs_error_t SrsConfig::raw_set_utc_time (string utc_time, bool & applied)
3019
3019
{
3020
- int ret = ERROR_SUCCESS ;
3020
+ srs_error_t err = srs_success ;
3021
3021
3022
3022
applied = false ;
3023
3023
3024
3024
SrsConfDirective* conf = root->get_or_create (" utc_time" );
3025
3025
3026
3026
if (conf->arg0 () == utc_time) {
3027
- return ret ;
3027
+ return err ;
3028
3028
}
3029
3029
3030
3030
conf->args .clear ();
3031
3031
conf->args .push_back (utc_time);
3032
3032
3033
- if ((ret = do_reload_utc_time ()) != ERROR_SUCCESS ) {
3034
- return ret ;
3033
+ if ((err = do_reload_utc_time ()) != srs_success ) {
3034
+ return srs_error_wrap (err, " reload " ) ;
3035
3035
}
3036
3036
3037
3037
applied = true ;
3038
3038
3039
- return ret ;
3039
+ return err ;
3040
3040
}
3041
3041
3042
3042
int SrsConfig::raw_set_pithy_print_ms (string pithy_print_ms, bool & applied)
@@ -3307,21 +3307,20 @@ int SrsConfig::do_reload_max_connections()
3307
3307
return ret;
3308
3308
}
3309
3309
3310
- int SrsConfig::do_reload_utc_time ()
3310
+ srs_error_t SrsConfig::do_reload_utc_time ()
3311
3311
{
3312
- int ret = ERROR_SUCCESS ;
3312
+ srs_error_t err = srs_success ;
3313
3313
3314
3314
vector<ISrsReloadHandler*>::iterator it;
3315
3315
for (it = subscribes.begin (); it != subscribes.end (); ++it) {
3316
3316
ISrsReloadHandler* subscribe = *it;
3317
- if ((ret = subscribe->on_reload_utc_time ()) != ERROR_SUCCESS) {
3318
- srs_error (" notify subscribes utc_time failed. ret=%d" , ret);
3319
- return ret;
3317
+ if ((err = subscribe->on_reload_utc_time ()) != srs_success) {
3318
+ return srs_error_wrap (err, " utc_time" );
3320
3319
}
3321
3320
}
3322
3321
srs_trace (" reload utc_time success." );
3323
3322
3324
- return ret ;
3323
+ return err ;
3325
3324
}
3326
3325
3327
3326
int SrsConfig::do_reload_pithy_print_ms ()
0 commit comments