mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Rename SrsCoroutineManager to SrsConnectionManager
This commit is contained in:
parent
d8a158290f
commit
4eae93d27b
10 changed files with 20 additions and 23 deletions
|
@ -49,7 +49,7 @@ SrsAppCasterFlv::SrsAppCasterFlv(SrsConfDirective* c)
|
|||
{
|
||||
http_mux = new SrsHttpServeMux();
|
||||
output = _srs_config->get_stream_caster_output(c);
|
||||
manager = new SrsCoroutineManager();
|
||||
manager = new SrsConnectionManager();
|
||||
}
|
||||
|
||||
SrsAppCasterFlv::~SrsAppCasterFlv()
|
||||
|
|
|
@ -54,7 +54,7 @@ private:
|
|||
std::string output;
|
||||
SrsHttpServeMux* http_mux;
|
||||
std::vector<SrsHttpConn*> conns;
|
||||
SrsCoroutineManager* manager;
|
||||
SrsConnectionManager* manager;
|
||||
public:
|
||||
SrsAppCasterFlv(SrsConfDirective* c);
|
||||
virtual ~SrsAppCasterFlv();
|
||||
|
|
|
@ -31,13 +31,13 @@ using namespace std;
|
|||
#include <srs_app_utility.hpp>
|
||||
#include <srs_kernel_utility.hpp>
|
||||
|
||||
SrsCoroutineManager::SrsCoroutineManager()
|
||||
SrsConnectionManager::SrsConnectionManager()
|
||||
{
|
||||
cond = srs_cond_new();
|
||||
trd = new SrsSTCoroutine("manager", this);
|
||||
}
|
||||
|
||||
SrsCoroutineManager::~SrsCoroutineManager()
|
||||
SrsConnectionManager::~SrsConnectionManager()
|
||||
{
|
||||
srs_freep(trd);
|
||||
srs_cond_destroy(cond);
|
||||
|
@ -45,7 +45,7 @@ SrsCoroutineManager::~SrsCoroutineManager()
|
|||
clear();
|
||||
}
|
||||
|
||||
srs_error_t SrsCoroutineManager::start()
|
||||
srs_error_t SrsConnectionManager::start()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -56,7 +56,7 @@ srs_error_t SrsCoroutineManager::start()
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsCoroutineManager::cycle()
|
||||
srs_error_t SrsConnectionManager::cycle()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -72,7 +72,7 @@ srs_error_t SrsCoroutineManager::cycle()
|
|||
return err;
|
||||
}
|
||||
|
||||
void SrsCoroutineManager::remove(ISrsConnection* c)
|
||||
void SrsConnectionManager::remove(ISrsConnection* c)
|
||||
{
|
||||
if (::find(conns.begin(), conns.end(), c) == conns.end()) {
|
||||
conns.push_back(c);
|
||||
|
@ -80,7 +80,7 @@ void SrsCoroutineManager::remove(ISrsConnection* c)
|
|||
srs_cond_signal(cond);
|
||||
}
|
||||
|
||||
void SrsCoroutineManager::clear()
|
||||
void SrsConnectionManager::clear()
|
||||
{
|
||||
// To prevent thread switch when delete connection,
|
||||
// we copy all connections then free one by one.
|
||||
|
|
|
@ -36,19 +36,16 @@
|
|||
|
||||
class SrsWallClock;
|
||||
|
||||
// The coroutine manager use a thread to delete a connection, which will stop the service
|
||||
// thread, for example, when the RTMP connection thread cycle terminated, it will notify
|
||||
// the manager(the server) to remove the connection from list of server and push it to
|
||||
// the manager thread to delete it, finally the thread of connection will stop.
|
||||
class SrsCoroutineManager : virtual public ISrsCoroutineHandler, virtual public IConnectionManager
|
||||
// The connection manager remove connection and delete it asynchronously.
|
||||
class SrsConnectionManager : virtual public ISrsCoroutineHandler, virtual public IConnectionManager
|
||||
{
|
||||
private:
|
||||
SrsCoroutine* trd;
|
||||
std::vector<ISrsConnection*> conns;
|
||||
srs_cond_t cond;
|
||||
public:
|
||||
SrsCoroutineManager();
|
||||
virtual ~SrsCoroutineManager();
|
||||
SrsConnectionManager();
|
||||
virtual ~SrsConnectionManager();
|
||||
public:
|
||||
srs_error_t start();
|
||||
// Interface ISrsCoroutineHandler
|
||||
|
|
|
@ -1890,7 +1890,7 @@ SrsGb28181Manger::SrsGb28181Manger(SrsServer *s, SrsConfDirective* c)
|
|||
// TODO: FIXME: support reload.
|
||||
server = s;
|
||||
config = new SrsGb28181Config(c);
|
||||
manager = new SrsCoroutineManager();
|
||||
manager = new SrsConnectionManager();
|
||||
}
|
||||
|
||||
SrsGb28181Manger::~SrsGb28181Manger()
|
||||
|
|
|
@ -473,7 +473,7 @@ private:
|
|||
std::map<uint32_t, SrsPsRtpListener*> rtp_pool;
|
||||
std::map<uint32_t, SrsGb28181RtmpMuxer*> rtmpmuxers_ssrc;
|
||||
std::map<std::string, SrsGb28181RtmpMuxer*> rtmpmuxers;
|
||||
SrsCoroutineManager* manager;
|
||||
SrsConnectionManager* manager;
|
||||
SrsGb28181SipService* sip_service;
|
||||
SrsServer* server;
|
||||
public:
|
||||
|
|
|
@ -712,7 +712,7 @@ SrsRtspCaster::SrsRtspCaster(SrsConfDirective* c)
|
|||
output = _srs_config->get_stream_caster_output(c);
|
||||
local_port_min = _srs_config->get_stream_caster_rtp_port_min(c);
|
||||
local_port_max = _srs_config->get_stream_caster_rtp_port_max(c);
|
||||
manager = new SrsCoroutineManager();
|
||||
manager = new SrsConnectionManager();
|
||||
}
|
||||
|
||||
SrsRtspCaster::~SrsRtspCaster()
|
||||
|
|
|
@ -51,7 +51,7 @@ class SrsAudioFrame;
|
|||
class SrsSimpleStream;
|
||||
class SrsPithyPrint;
|
||||
class SrsSimpleRtmpClient;
|
||||
class SrsCoroutineManager;
|
||||
class SrsConnectionManager;
|
||||
|
||||
// A rtp connection which transport a stream.
|
||||
class SrsRtpConn: public ISrsUdpHandler
|
||||
|
@ -182,7 +182,7 @@ private:
|
|||
std::map<int, bool> used_ports;
|
||||
private:
|
||||
std::vector<SrsRtspConn*> clients;
|
||||
SrsCoroutineManager* manager;
|
||||
SrsConnectionManager* manager;
|
||||
public:
|
||||
SrsRtspCaster(SrsConfDirective* c);
|
||||
virtual ~SrsRtspCaster();
|
||||
|
|
|
@ -656,7 +656,7 @@ SrsServer::SrsServer()
|
|||
pid_fd = -1;
|
||||
|
||||
signal_manager = new SrsSignalManager(this);
|
||||
conn_manager = new SrsCoroutineManager();
|
||||
conn_manager = new SrsConnectionManager();
|
||||
|
||||
handler = NULL;
|
||||
ppid = ::getppid();
|
||||
|
|
|
@ -53,7 +53,7 @@ class SrsUdpListener;
|
|||
class SrsTcpListener;
|
||||
class SrsAppCasterFlv;
|
||||
class SrsRtspCaster;
|
||||
class SrsCoroutineManager;
|
||||
class SrsConnectionManager;
|
||||
class SrsGb28181Caster;
|
||||
|
||||
|
||||
|
@ -249,7 +249,7 @@ private:
|
|||
SrsHttpServer* http_server;
|
||||
SrsHttpHeartbeat* http_heartbeat;
|
||||
SrsIngester* ingester;
|
||||
SrsCoroutineManager* conn_manager;
|
||||
SrsConnectionManager* conn_manager;
|
||||
private:
|
||||
// The pid file fd, lock the file write when server is running.
|
||||
// @remark the init.d script should cleanup the pid file, when stop service,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue