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

fix bug of edge, one fd for one thread

This commit is contained in:
winlin 2014-04-28 17:20:35 +08:00
parent 241d04b391
commit c681098949
6 changed files with 144 additions and 27 deletions

View file

@ -41,6 +41,7 @@ class SrsPlayEdge;
class SrsPublishEdge;
class SrsRtmpClient;
class SrsCommonMessage;
class SrsMessageQueue;
class ISrsProtocolReaderWriter;
/**
@ -117,9 +118,22 @@ private:
ISrsProtocolReaderWriter* io;
SrsRtmpClient* client;
int origin_index;
/**
* we must ensure one thread one fd principle,
* that is, a fd must be write/read by the one thread.
* the publish service thread will proxy(msg), and the edge forward thread
* will cycle(), so we use queue for cycle to send the msg of proxy.
*/
SrsMessageQueue* queue;
/**
* error code of send, for edge proxy thread to query.
*/
int send_error_code;
public:
SrsEdgeForwarder();
virtual ~SrsEdgeForwarder();
public:
virtual void set_queue_size(double queue_size);
public:
virtual int initialize(SrsSource* source, SrsPublishEdge* edge, SrsRequest* req);
virtual int start();
@ -179,6 +193,8 @@ private:
public:
SrsPublishEdge();
virtual ~SrsPublishEdge();
public:
virtual void set_queue_size(double queue_size);
public:
virtual int initialize(SrsSource* source, SrsRequest* req);
/**