From 55c96192e23b147828eadce6750c939c99e3d652 Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 16 Feb 2018 10:19:48 +0800 Subject: [PATCH] For #464, refine code --- trunk/src/app/srs_app_coworkers.cpp | 20 ++++++++++---------- trunk/src/app/srs_app_coworkers.hpp | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/trunk/src/app/srs_app_coworkers.cpp b/trunk/src/app/srs_app_coworkers.cpp index 77787b46ed..3ab06232eb 100644 --- a/trunk/src/app/srs_app_coworkers.cpp +++ b/trunk/src/app/srs_app_coworkers.cpp @@ -41,11 +41,11 @@ SrsCoWorkers::SrsCoWorkers() SrsCoWorkers::~SrsCoWorkers() { map::iterator it; - for (it = vhosts.begin(); it != vhosts.end(); ++it) { + for (it = streams.begin(); it != streams.end(); ++it) { SrsRequest* r = it->second; srs_freep(r); } - vhosts.clear(); + streams.clear(); } SrsCoWorkers* SrsCoWorkers::instance() @@ -90,8 +90,8 @@ SrsRequest* SrsCoWorkers::find_stream_info(string vhost, string app, string stre // Get stream information from local cache. string url = srs_generate_stream_url(conf->arg0(), app, stream); - map::iterator it = vhosts.find(url); - if (it == vhosts.end()) { + map::iterator it = streams.find(url); + if (it == streams.end()) { return NULL; } @@ -105,13 +105,13 @@ srs_error_t SrsCoWorkers::on_publish(SrsSource* s, SrsRequest* r) string url = r->get_stream_url(); // Delete the previous stream informations. - map::iterator it = vhosts.find(url); - if (it != vhosts.end()) { + map::iterator it = streams.find(url); + if (it != streams.end()) { srs_freep(it->second); } // Always use the latest one. - vhosts[url] = r->copy(); + streams[url] = r->copy(); return err; } @@ -120,10 +120,10 @@ void SrsCoWorkers::on_unpublish(SrsSource* s, SrsRequest* r) { string url = r->get_stream_url(); - map::iterator it = vhosts.find(url); - if (it != vhosts.end()) { + map::iterator it = streams.find(url); + if (it != streams.end()) { srs_freep(it->second); - vhosts.erase(it); + streams.erase(it); } } diff --git a/trunk/src/app/srs_app_coworkers.hpp b/trunk/src/app/srs_app_coworkers.hpp index 55bb9e334d..80c09dfa85 100644 --- a/trunk/src/app/srs_app_coworkers.hpp +++ b/trunk/src/app/srs_app_coworkers.hpp @@ -38,7 +38,7 @@ class SrsCoWorkers private: static SrsCoWorkers* _instance; private: - std::map vhosts; + std::map streams; private: SrsCoWorkers(); virtual ~SrsCoWorkers();