summaryrefslogtreecommitdiff
path: root/src/node_http2.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-05-27 16:41:35 +0200
committerAnna Henningsen <anna@addaleax.net>2018-05-31 09:54:49 +0200
commit15c7a49bfca1db23f4f7a3a79aea04a0075fbd62 (patch)
tree157b58599337e4c0d00f174e0e76b11c8b77b783 /src/node_http2.h
parentbd85844c4e80c7aa1fc02a986c7619c3956b0061 (diff)
downloadandroid-node-v8-15c7a49bfca1db23f4f7a3a79aea04a0075fbd62.tar.gz
android-node-v8-15c7a49bfca1db23f4f7a3a79aea04a0075fbd62.tar.bz2
android-node-v8-15c7a49bfca1db23f4f7a3a79aea04a0075fbd62.zip
http2: switch to new runtime-controlled debugging system
Remove `--debug-http2` as a compile-time feature and make all debug statements available using `NODE_DEBUG_NATIVE=http2` at runtime. This probably makes the debugging-enabled case a bit slower due to additional string concatenations, but switching to a runtime-checking system makes debugging more flexible and can be applied more easily to other parts of the source code as well. PR-URL: https://github.com/nodejs/node/pull/20987 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_http2.h')
-rw-r--r--src/node_http2.h60
1 files changed, 4 insertions, 56 deletions
diff --git a/src/node_http2.h b/src/node_http2.h
index 043449624f..824084d0ba 100644
--- a/src/node_http2.h
+++ b/src/node_http2.h
@@ -21,61 +21,6 @@ using v8::MaybeLocal;
using performance::PerformanceEntry;
-#ifdef NODE_DEBUG_HTTP2
-
-// Adapted from nghttp2 own debug printer
-static inline void _debug_vfprintf(const char* fmt, va_list args) {
- vfprintf(stderr, fmt, args);
-}
-
-void inline debug_vfprintf(const char* format, ...) {
- va_list args;
- va_start(args, format);
- _debug_vfprintf(format, args);
- va_end(args);
-}
-
-#define DEBUG_HTTP2(...) debug_vfprintf(__VA_ARGS__);
-#define DEBUG_HTTP2SESSION(session, message) \
- do { \
- if (session != nullptr) { \
- DEBUG_HTTP2("Http2Session %s (%.0lf) " message "\n", \
- session->TypeName(), \
- session->get_async_id()); \
- } \
- } while (0)
-#define DEBUG_HTTP2SESSION2(session, message, ...) \
- do { \
- if (session != nullptr) { \
- DEBUG_HTTP2("Http2Session %s (%.0lf) " message "\n", \
- session->TypeName(), \
- session->get_async_id(), \
- __VA_ARGS__); \
- } \
- } while (0)
-#define DEBUG_HTTP2STREAM(stream, message) \
- do { \
- DEBUG_HTTP2("Http2Stream %d (%.0lf) [Http2Session %s (%.0lf)] " message \
- "\n", stream->id(), stream->get_async_id(), \
- stream->session()->TypeName(), \
- stream->session()->get_async_id()); \
- } while (0)
-#define DEBUG_HTTP2STREAM2(stream, message, ...) \
- do { \
- DEBUG_HTTP2("Http2Stream %d (%.0lf) [Http2Session %s (%.0lf)] " message \
- "\n", stream->id(), stream->get_async_id(), \
- stream->session()->TypeName(), \
- stream->session()->get_async_id(), \
- __VA_ARGS__); \
- } while (0)
-#else
-#define DEBUG_HTTP2(...) do {} while (0)
-#define DEBUG_HTTP2SESSION(...) do {} while (0)
-#define DEBUG_HTTP2SESSION2(...) do {} while (0)
-#define DEBUG_HTTP2STREAM(...) do {} while (0)
-#define DEBUG_HTTP2STREAM2(...) do {} while (0)
-#endif
-
// We strictly limit the number of outstanding unacknowledged PINGS a user
// may send in order to prevent abuse. The current default cap is 10. The
// user may set a different limit using a per Http2Session configuration
@@ -557,6 +502,7 @@ class Http2Stream : public AsyncWrap,
nghttp2_stream* operator*();
Http2Session* session() { return session_; }
+ const Http2Session* session() const { return session_; }
void EmitStatistics();
@@ -675,6 +621,7 @@ class Http2Stream : public AsyncWrap,
uv_stream_t* send_handle) override;
size_t self_size() const override { return sizeof(*this); }
+ std::string diagnostic_name() const override;
// JavaScript API
static void GetID(const FunctionCallbackInfo<Value>& args);
@@ -819,7 +766,7 @@ class Http2Session : public AsyncWrap, public StreamListener {
inline uint32_t GetMaxHeaderPairs() const { return max_header_pairs_; }
- inline const char* TypeName();
+ inline const char* TypeName() const;
inline bool IsDestroyed() {
return (flags_ & SESSION_STATE_CLOSED) || session_ == nullptr;
@@ -849,6 +796,7 @@ class Http2Session : public AsyncWrap, public StreamListener {
ssize_t Write(const uv_buf_t* bufs, size_t nbufs);
size_t self_size() const override { return sizeof(*this); }
+ std::string diagnostic_name() const override;
// Schedule an RstStream for after the current write finishes.
inline void AddPendingRstStream(int32_t stream_id) {