mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Merge srs_app_thread.hpp to srs_app_conn.hpp
This commit is contained in:
parent
60c759919f
commit
2135b638b1
20 changed files with 100 additions and 173 deletions
|
@ -27,15 +27,40 @@
|
|||
#include <srs_core.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <srs_app_st.hpp>
|
||||
#include <srs_app_thread.hpp>
|
||||
#include <srs_protocol_kbps.hpp>
|
||||
#include <srs_app_reload.hpp>
|
||||
#include <srs_service_conn.hpp>
|
||||
|
||||
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
|
||||
{
|
||||
private:
|
||||
SrsCoroutine* trd;
|
||||
std::vector<ISrsConnection*> conns;
|
||||
srs_cond_t cond;
|
||||
public:
|
||||
SrsCoroutineManager();
|
||||
virtual ~SrsCoroutineManager();
|
||||
public:
|
||||
srs_error_t start();
|
||||
// Interface ISrsCoroutineHandler
|
||||
public:
|
||||
virtual srs_error_t cycle();
|
||||
// Interface IConnectionManager
|
||||
public:
|
||||
virtual void remove(ISrsConnection* c);
|
||||
private:
|
||||
void clear();
|
||||
};
|
||||
|
||||
// The basic connection of SRS,
|
||||
// all connections accept from listener must extends from this base class,
|
||||
// server will add the connection to manager, and delete it when remove.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue