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

For #1181, Refine code to write utest

This commit is contained in:
winlin 2018-08-11 12:33:03 +08:00
parent c582590bb0
commit 01d8bba455
5 changed files with 44 additions and 28 deletions

View file

@ -1404,16 +1404,19 @@ srs_error_t SrsHttpApi::do_cycle()
ISrsHttpMessage* req = NULL;
// get a http message
if ((err = parser->parse_message(skt, this, &req)) != srs_success) {
if ((err = parser->parse_message(skt, &req)) != srs_success) {
return srs_error_wrap(err, "parse message");
}
// if SUCCESS, always NOT-NULL.
srs_assert(req);
// always free it in this scope.
srs_assert(req);
SrsAutoFree(ISrsHttpMessage, req);
// Attach owner connection to message.
SrsHttpMessage* hreq = (SrsHttpMessage*)req;
hreq->set_connection(this);
// ok, handle http request.
SrsHttpResponseWriter writer(skt);
if ((err = process_request(&writer, req)) != srs_success) {