Skip to content

Commit

Permalink
For #1657: Refine code
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Nov 5, 2020
1 parent 24125b9 commit 9cf4203
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions trunk/src/app/srs_app_caster_flv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class SrsAppCasterFlv : virtual public ISrsTcpHandler
};

// The dynamic http connection, never drop the body.
class SrsDynamicHttpConn : virtual public ISrsStartableConneciton, virtual public ISrsHttpMessageHandler
class SrsDynamicHttpConn : virtual public ISrsStartableConneciton, virtual public ISrsHttpConnOwner
{
private:
// The manager object to manage the connection.
Expand All @@ -93,7 +93,7 @@ class SrsDynamicHttpConn : virtual public ISrsStartableConneciton, virtual publi
private:
virtual srs_error_t do_proxy(ISrsHttpResponseReader* rr, SrsFlvDecoder* dec);
// Extract APIs from SrsTcpConnection.
// Interface ISrsHttpMessageHandler.
// Interface ISrsHttpConnOwner.
public:
virtual srs_error_t on_http_message(ISrsHttpMessage* msg);
virtual void on_conn_done();
Expand Down
8 changes: 4 additions & 4 deletions trunk/src/app/srs_app_http_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ using namespace std;
#include <srs_app_utility.hpp>
#include <srs_app_st.hpp>

ISrsHttpMessageHandler::ISrsHttpMessageHandler()
ISrsHttpConnOwner::ISrsHttpConnOwner()
{
}

ISrsHttpMessageHandler::~ISrsHttpMessageHandler()
ISrsHttpConnOwner::~ISrsHttpConnOwner()
{
}

SrsHttpConn::SrsHttpConn(ISrsHttpMessageHandler* handler, srs_netfd_t fd, ISrsHttpServeMux* m, string cip, int cport)
SrsHttpConn::SrsHttpConn(ISrsHttpConnOwner* handler, srs_netfd_t fd, ISrsHttpServeMux* m, string cip, int cport)
{
parser = new SrsHttpParser();
cors = new SrsHttpCorsMux();
Expand Down Expand Up @@ -184,7 +184,7 @@ srs_error_t SrsHttpConn::do_cycle()
return err;
}

ISrsHttpMessageHandler* SrsHttpConn::handler()
ISrsHttpConnOwner* SrsHttpConn::handler()
{
return handler_;
}
Expand Down
18 changes: 9 additions & 9 deletions trunk/src/app/srs_app_http_conn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ class SrsHttpMessage;
class SrsHttpStreamServer;
class SrsHttpStaticServer;

// The handler for HTTP message.
class ISrsHttpMessageHandler
// The owner of HTTP connection.
class ISrsHttpConnOwner
{
public:
ISrsHttpMessageHandler();
virtual ~ISrsHttpMessageHandler();
ISrsHttpConnOwner();
virtual ~ISrsHttpConnOwner();
public:
// Handle the HTTP message msg, which may be parsed partially.
// For the static service or api, discard any body.
Expand All @@ -77,7 +77,7 @@ class SrsHttpConn : virtual public ISrsStartableConneciton, virtual public ISrsR
SrsHttpParser* parser;
ISrsHttpServeMux* http_mux;
SrsHttpCorsMux* cors;
ISrsHttpMessageHandler* handler_;
ISrsHttpConnOwner* handler_;
protected:
SrsTcpConnection* skt;
// Each connection start a green thread,
Expand All @@ -97,7 +97,7 @@ class SrsHttpConn : virtual public ISrsStartableConneciton, virtual public ISrsR
// for current connection to log self create time and calculate the living time.
int64_t create_time;
public:
SrsHttpConn(ISrsHttpMessageHandler* handler, srs_netfd_t fd, ISrsHttpServeMux* m, std::string cip, int port);
SrsHttpConn(ISrsHttpConnOwner* handler, srs_netfd_t fd, ISrsHttpServeMux* m, std::string cip, int port);
virtual ~SrsHttpConn();
// Interface ISrsResource.
public:
Expand All @@ -109,7 +109,7 @@ class SrsHttpConn : virtual public ISrsStartableConneciton, virtual public ISrsR
virtual srs_error_t do_cycle();
public:
// Get the HTTP message handler.
virtual ISrsHttpMessageHandler* handler();
virtual ISrsHttpConnOwner* handler();
// Whether the connection coroutine is error or terminated.
virtual srs_error_t pull();
private:
Expand Down Expand Up @@ -143,7 +143,7 @@ class SrsHttpConn : virtual public ISrsStartableConneciton, virtual public ISrsR
};

// Drop body of request, only process the response.
class SrsResponseOnlyHttpConn : virtual public ISrsStartableConneciton, virtual public ISrsHttpMessageHandler
class SrsResponseOnlyHttpConn : virtual public ISrsStartableConneciton, virtual public ISrsHttpConnOwner
{
private:
// The manager object to manage the connection.
Expand All @@ -160,7 +160,7 @@ class SrsResponseOnlyHttpConn : virtual public ISrsStartableConneciton, virtual
// @see https://github.com/ossrs/srs/issues/636#issuecomment-298208427
// @remark Should only used in HTTP-FLV streaming connection.
virtual srs_error_t pop_message(ISrsHttpMessage** preq);
// Interface ISrsHttpMessageHandler.
// Interface ISrsHttpConnOwner.
public:
virtual srs_error_t on_http_message(ISrsHttpMessage* msg);
virtual void on_conn_done();
Expand Down

0 comments on commit 9cf4203

Please sign in to comment.