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

@ -31,6 +31,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_performance.hpp>
#include <srs_app_config.hpp>
#include <srs_app_source.hpp>
#include <srs_app_http_conn.hpp>
#include <srs_core_autofree.hpp>
using namespace std;
@ -523,3 +525,42 @@ void SrsPublishRecvThread::set_socket_buffer(int sleep_ms)
rtmp->set_recv_buffer(nb_rbuf);
}
SrsHttpRecvThread::SrsHttpRecvThread(SrsResponseOnlyHttpConn* c)
{
conn = c;
error = ERROR_SUCCESS;
trd = new SrsOneCycleThread("http-receive", this);
}
SrsHttpRecvThread::~SrsHttpRecvThread()
{
srs_freep(trd);
}
int SrsHttpRecvThread::start()
{
return trd->start();
}
int SrsHttpRecvThread::error_code()
{
return error;
}
int SrsHttpRecvThread::cycle()
{
int ret = ERROR_SUCCESS;
while (true) {
ISrsHttpMessage* req = NULL;
SrsAutoFree(ISrsHttpMessage, req);
if ((ret = conn->pop_message(&req)) != ERROR_SUCCESS) {
error = ret;
break;
}
}
return ret;
}