winlin

Merge branch '2.0release' into develop

@@ -1038,7 +1038,18 @@ int SrsSource::cycle() @@ -1038,7 +1038,18 @@ int SrsSource::cycle()
1038 1038
1039 bool SrsSource::expired() 1039 bool SrsSource::expired()
1040 { 1040 {
1041 - if (!consumers.empty() || die_at == -1) { 1041 + // unknown state?
  1042 + if (die_at == -1) {
  1043 + return false;
  1044 + }
  1045 +
  1046 + // still publishing?
  1047 + if (!_can_publish) {
  1048 + return false;
  1049 + }
  1050 +
  1051 + // has any consumers?
  1052 + if (!consumers.empty()) {
1042 return false; 1053 return false;
1043 } 1054 }
1044 1055
@@ -2226,7 +2237,6 @@ int SrsSource::create_consumer(SrsConnection* conn, SrsConsumer*& consumer, bool @@ -2226,7 +2237,6 @@ int SrsSource::create_consumer(SrsConnection* conn, SrsConsumer*& consumer, bool
2226 { 2237 {
2227 int ret = ERROR_SUCCESS; 2238 int ret = ERROR_SUCCESS;
2228 2239
2229 - die_at = -1;  
2230 consumer = new SrsConsumer(this, conn); 2240 consumer = new SrsConsumer(this, conn);
2231 consumers.push_back(consumer); 2241 consumers.push_back(consumer);
2232 2242