1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #906, #902, use coroutine for one cycle thread

This commit is contained in:
winlin 2017-05-29 19:45:19 +08:00
parent b21f92f97a
commit 2ed2513f08
11 changed files with 44 additions and 212 deletions

View file

@ -39,20 +39,15 @@
* all connections accept from listener must extends from this base class,
* server will add the connection to manager, and delete it when remove.
*/
class SrsConnection : virtual public ISrsConnection, virtual public ISrsOneCycleThreadHandler
class SrsConnection : virtual public ISrsConnection, virtual public ISrsCoroutineHandler
, virtual public IKbpsDelta, virtual public ISrsReloadHandler
{
private:
protected:
/**
* each connection start a green thread,
* when thread stop, the connection will be delete by server.
*/
SrsOneCycleThread* pthread;
/**
* the id of connection.
*/
int id;
protected:
SrsCoroutine* trd;
/**
* the manager object to manage the connection.
*/
@ -65,16 +60,6 @@ protected:
* the ip of client.
*/
std::string ip;
/**
* whether the connection is disposed,
* when disposed, connection should stop cycle and cleanup itself.
*/
bool disposed;
/**
* whether connection is expired, application definition.
* when expired, the connection must never be served and quit ASAP.
*/
bool expired;
/**
* the underlayer socket.
*/