winlin

fix #79: allow edge vhost to add or remove.

@@ -867,18 +867,6 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root) @@ -867,18 +867,6 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
867 SrsConfDirective* old_vhost = old_root->get("vhost", vhost); 867 SrsConfDirective* old_vhost = old_root->get("vhost", vhost);
868 SrsConfDirective* new_vhost = root->get("vhost", vhost); 868 SrsConfDirective* new_vhost = root->get("vhost", vhost);
869 869
870 - // mode, never supports reload.  
871 - // first, for the origin and edge role change is too complex.  
872 - // second, the vhosts in origin device group normally are all origin,  
873 - // they never change to edge sometimes.  
874 - // third, the origin or upnode device can always be restart,  
875 - // edge will retry and the users connected to edge are ok.  
876 - if (get_vhost_is_edge(old_vhost) != get_vhost_is_edge(new_vhost)) {  
877 - ret = ERROR_RTMP_EDGE_RELOAD;  
878 - srs_error("reload never supports mode changed. ret=%d", ret);  
879 - return ret;  
880 - }  
881 -  
882 // DISABLED => ENABLED 870 // DISABLED => ENABLED
883 if (!get_vhost_enabled(old_vhost) && get_vhost_enabled(new_vhost)) { 871 if (!get_vhost_enabled(old_vhost) && get_vhost_enabled(new_vhost)) {
884 srs_trace("vhost %s added, reload it.", vhost.c_str()); 872 srs_trace("vhost %s added, reload it.", vhost.c_str());
@@ -908,6 +896,19 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root) @@ -908,6 +896,19 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
908 srs_trace("reload removed vhost %s success.", vhost.c_str()); 896 srs_trace("reload removed vhost %s success.", vhost.c_str());
909 continue; 897 continue;
910 } 898 }
  899 +
  900 + // mode, never supports reload.
  901 + // first, for the origin and edge role change is too complex.
  902 + // second, the vhosts in origin device group normally are all origin,
  903 + // they never change to edge sometimes.
  904 + // third, the origin or upnode device can always be restart,
  905 + // edge will retry and the users connected to edge are ok.
  906 + // it's ok to add or remove edge/origin vhost.
  907 + if (get_vhost_is_edge(old_vhost) != get_vhost_is_edge(new_vhost)) {
  908 + ret = ERROR_RTMP_EDGE_RELOAD;
  909 + srs_error("reload never supports mode changed. ret=%d", ret);
  910 + return ret;
  911 + }
911 912
912 // ENABLED => ENABLED (modified) 913 // ENABLED => ENABLED (modified)
913 if (get_vhost_enabled(new_vhost) && get_vhost_enabled(old_vhost)) { 914 if (get_vhost_enabled(new_vhost) && get_vhost_enabled(old_vhost)) {