This is an automated email from the ASF dual-hosted git repository. jpeach pushed a commit to branch master in repository https://git-dual.apache.org/repos/asf/trafficserver.git
commit 6a60304c88882f238b7ae2a584407dacd4b91318 Author: James Peach <[email protected]> AuthorDate: Fri Oct 7 21:05:55 2016 -0700 Minor formatting cleanups. - Bring class members together. - Remove extraneous semi-colons. - Add newlines after inline member function definitions. - Apply USE_HTTP_DEBUG_LISTS consistently. --- proxy/ProxyClientSession.cc | 2 +- proxy/ProxyClientSession.h | 69 +++++++++++++++++++++------------------ proxy/http/Http1ClientSession.cc | 4 +++ proxy/http/Http1ClientSession.h | 19 +++++++---- proxy/http/HttpProxyServerMain.cc | 2 ++ proxy/http2/Http2ClientSession.h | 10 ++++-- 6 files changed, 66 insertions(+), 40 deletions(-) diff --git a/proxy/ProxyClientSession.cc b/proxy/ProxyClientSession.cc index 37c2e5c..c1191d6 100644 --- a/proxy/ProxyClientSession.cc +++ b/proxy/ProxyClientSession.cc @@ -28,7 +28,7 @@ static int64_t next_cs_id = 0; ProxyClientSession::ProxyClientSession() - : VConnection(NULL), acl_record(NULL), host_res_style(HOST_RES_IPV4), debug_on(false), hooks_on(true), con_id(0), m_active(false) + : VConnection(NULL), acl_record(NULL), host_res_style(HOST_RES_IPV4), debug_on(false), hooks_on(true), in_destroy(false), con_id(0), m_active(false) { ink_zero(this->user_args); } diff --git a/proxy/ProxyClientSession.h b/proxy/ProxyClientSession.h index b5fe056..6b4bf8b 100644 --- a/proxy/ProxyClientSession.h +++ b/proxy/ProxyClientSession.h @@ -49,6 +49,13 @@ public: virtual void new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOBufferReader *reader, bool backdoor) = 0; + virtual NetVConnection *get_netvc() const = 0; + virtual void release_netvc() = 0; + + virtual int get_transact_count() const = 0; + + virtual const char *get_protocol_string() const = 0; + virtual void ssn_hook_append(TSHttpHookID id, INKContInternal *cont) { @@ -61,9 +68,6 @@ public: this->api_hooks.prepend(id, cont); } - virtual NetVConnection *get_netvc() const = 0; - virtual void release_netvc() = 0; - APIHook * ssn_hook_get(TSHttpHookID id) const { @@ -106,33 +110,28 @@ public: // Initiate an API hook invocation. void do_api_callout(TSHttpHookID id); - static int64_t next_connection_id(); - virtual int get_transact_count() const = 0; - - // Override if your session protocol allows this + // Override if your session protocol allows this. virtual bool - is_transparent_passthrough_allowed() + is_transparent_passthrough_allowed() const { return false; } - // Override if your session protocol cares + // Override if your session protocol cares. virtual void set_half_close_flag(bool flag) { } + virtual bool get_half_close_flag() const { return false; } - // Indicate we are done with a transaction + // Indicate we are done with a transaction. virtual void release(ProxyClientTransaction *trans) = 0; - /// acl record - cache IpAllow::match() call - const AclRecord *acl_record; - int64_t connection_id() const { @@ -150,33 +149,26 @@ public: return NULL; } - /// DNS resolution preferences. - HostResStyle host_res_style; - - virtual int state_api_callout(int event, void *edata); - TSHttpHookID get_hookid() const { return api_hookid; } - ink_hrtime ssn_start_time; - ink_hrtime ssn_last_txn_time; - virtual void set_active_timeout(ink_hrtime timeout_in) { } + virtual void set_inactivity_timeout(ink_hrtime timeout_in) { } + virtual void cancel_inactivity_timeout() { } - virtual const char *get_protocol_string() const = 0; bool is_client_closed() const @@ -188,9 +180,11 @@ public: populate_protocol(char const **result, int size) const { int retval = 0; + if (get_netvc()) { retval += this->get_netvc()->populate_protocol(result, size); } + return retval; } @@ -198,40 +192,53 @@ public: protocol_contains(const char *tag_prefix) const { const char *retval = NULL; + if (get_netvc()) { retval = this->get_netvc()->protocol_contains(tag_prefix); } + return retval; } void set_session_active(); void clear_session_active(); + static int64_t next_connection_id(); + + /// acl record - cache IpAllow::match() call + const AclRecord *acl_record; + + /// DNS resolution preferences. + HostResStyle host_res_style; + + ink_hrtime ssn_start_time; + ink_hrtime ssn_last_txn_time; + protected: - // XXX Consider using a bitwise flags variable for the following flags, so that we can make the best - // use of internal alignment padding. + // XXX Consider using a bitwise flags variable for the following flags, so + // that we can make the best use of internal alignment padding. // Session specific debug flag. bool debug_on; bool hooks_on; + bool in_destroy; int64_t con_id; - Event *schedule_event; - bool in_destroy; private: + ProxyClientSession(ProxyClientSession &); // noncopyable + ProxyClientSession &operator=(const ProxyClientSession &); // noncopyable + + void handle_api_return(int event); + int state_api_callout(int event, void *edata); + APIHookScope api_scope; TSHttpHookID api_hookid; APIHook *api_current; HttpAPIHooks api_hooks; void *user_args[HTTP_SSN_TXN_MAX_USER_ARG]; - ProxyClientSession(ProxyClientSession &); // noncopyable - ProxyClientSession &operator=(const ProxyClientSession &); // noncopyable - - void handle_api_return(int event); - // for DI. An active connection is one that a request has // been successfully parsed (PARSE_DONE) and it remains to // be active until the transaction goes through or the client diff --git a/proxy/http/Http1ClientSession.cc b/proxy/http/Http1ClientSession.cc index f87dbb9..3be6b6c 100644 --- a/proxy/http/Http1ClientSession.cc +++ b/proxy/http/Http1ClientSession.cc @@ -51,11 +51,15 @@ enum { HTTP_CS_MAGIC_DEAD = 0xDEADF00D, }; +#ifdef USE_HTTP_DEBUG_LISTS + // We have debugging list that we can use to find stuck // client sessions DList(Http1ClientSession, debug_link) debug_cs_list; ink_mutex debug_cs_list_mutex; +#endif /* USE_HTTP_DEBUG_LISTS */ + ClassAllocator<Http1ClientSession> http1ClientSessionAllocator("http1ClientSessionAllocator"); Http1ClientSession::Http1ClientSession() diff --git a/proxy/http/Http1ClientSession.h b/proxy/http/Http1ClientSession.h index 9de6bb4..97d64fa 100644 --- a/proxy/http/Http1ClientSession.h +++ b/proxy/http/Http1ClientSession.h @@ -41,13 +41,13 @@ #include "ProxyClientSession.h" #include "Http1ClientTransaction.h" +#ifdef USE_HTTP_DEBUG_LISTS extern ink_mutex debug_cs_list_mutex; +#endif class HttpSM; class HttpServerSession; -class SecurityContext; - class Http1ClientSession : public ProxyClientSession { public: @@ -79,17 +79,20 @@ public: set_half_close_flag(bool flag) { half_close = flag; - }; + } + bool get_half_close_flag() const { return half_close; - }; + } + virtual NetVConnection * get_netvc() const { return client_vc; - }; + } + virtual void release_netvc() { @@ -110,7 +113,7 @@ public: } virtual bool - is_outbound_transparent() + is_outbound_transparent() const { return f_outbound_transparent; } @@ -123,11 +126,13 @@ public: { return outbound_port; } + virtual IpAddr get_outbound_ip4() const { return outbound_ip4; } + virtual IpAddr get_outbound_ip6() const { @@ -148,12 +153,14 @@ public: if (client_vc) client_vc->set_active_timeout(timeout_in); } + void set_inactivity_timeout(ink_hrtime timeout_in) { if (client_vc) client_vc->set_inactivity_timeout(timeout_in); } + void cancel_inactivity_timeout() { diff --git a/proxy/http/HttpProxyServerMain.cc b/proxy/http/HttpProxyServerMain.cc index cbb221c..7b4b781 100644 --- a/proxy/http/HttpProxyServerMain.cc +++ b/proxy/http/HttpProxyServerMain.cc @@ -223,10 +223,12 @@ init_HttpProxyServer(int n_accept_threads) init_reverse_proxy(); httpSessionManager.init(); http_pages_init(); + #ifdef USE_HTTP_DEBUG_LISTS ink_mutex_init(&debug_sm_list_mutex, "HttpSM Debug List"); ink_mutex_init(&debug_cs_list_mutex, "HttpCS Debug List"); #endif + // DI's request to disable/reenable ICP on the fly icp_dynamic_enabled = 1; diff --git a/proxy/http2/Http2ClientSession.h b/proxy/http2/Http2ClientSession.h index fe5dd6e..8f23509 100644 --- a/proxy/http2/Http2ClientSession.h +++ b/proxy/http2/Http2ClientSession.h @@ -160,7 +160,7 @@ public: void start(); virtual void destroy(); virtual void free(); - void new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOBufferReader *reader, bool backdoor); + virtual void new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOBufferReader *reader, bool backdoor); bool ready_to_free() const @@ -174,11 +174,13 @@ public: void do_io_close(int lerrno = -1); void do_io_shutdown(ShutdownHowTo_t howto); void reenable(VIO *vio); + virtual NetVConnection * get_netvc() const { return client_vc; - }; + } + virtual void release_netvc() { @@ -203,6 +205,7 @@ public: } void set_upgrade_context(HTTPHdr *h); + const Http2UpgradeContext & get_upgrade_context() const { @@ -214,6 +217,7 @@ public: { return connection_state.get_stream_requests(); } + virtual void release(ProxyClientTransaction *trans) { @@ -225,11 +229,13 @@ public: { dying_event = event; } + int get_dying_event() const { return dying_event; } + bool is_recursing() const { -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
