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

Fix #636, FD leak for requesting empty HTTP stream. 2.0.241

This commit is contained in:
winlin 2017-04-30 12:03:31 +08:00
parent ff87318b95
commit ae5450181c
7 changed files with 110 additions and 2 deletions

View file

@ -43,6 +43,8 @@ class SrsRtmpConn;
class SrsSource;
class SrsRequest;
class SrsConsumer;
class SrsHttpConn;
class SrsResponseOnlyHttpConn;
/**
* for the recv thread to handle the message.
@ -215,5 +217,29 @@ private:
virtual void set_socket_buffer(int sleep_ms);
};
/**
* The HTTP receive thread, try to read messages util EOF.
* For example, the HTTP FLV serving thread will use the receive thread to break
* when client closed the request, to avoid FD leak.
* @see https://github.com/ossrs/srs/issues/636#issuecomment-298208427
*/
class SrsHttpRecvThread : public ISrsOneCycleThreadHandler
{
private:
SrsResponseOnlyHttpConn* conn;
SrsOneCycleThread* trd;
int error;
public:
SrsHttpRecvThread(SrsResponseOnlyHttpConn* c);
virtual ~SrsHttpRecvThread();
public:
virtual int start();
public:
virtual int error_code();
// interface ISrsOneCycleThreadHandler
public:
virtual int cycle();
};
#endif