]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
metrics: Handle the connection finished flushing event
authorDavid Goulet <dgoulet@torproject.org>
Wed, 17 Feb 2021 14:54:05 +0000 (09:54 -0500)
committerDavid Goulet <dgoulet@torproject.org>
Wed, 17 Feb 2021 14:54:05 +0000 (09:54 -0500)
Turns out, we forgot to add the METRICS connection type fo the finished
flushing handler.

Fixes #40295

Signed-off-by: David Goulet <dgoulet@torproject.org>
changes/ticket40295 [new file with mode: 0644]
src/core/mainloop/connection.c
src/feature/metrics/metrics.c
src/feature/metrics/metrics.h

diff --git a/changes/ticket40295 b/changes/ticket40295
new file mode 100644 (file)
index 0000000..e6dba80
--- /dev/null
@@ -0,0 +1,3 @@
+  o Minor bugfixes (metrics port):
+    - Fix a BUG() on the MetricsPort for an internal missing handler. Fixes bug
+      40295; bugfix on 0.4.5.1-alpha.
index 85cdec6e1e290632c3fa182788e3cd501ec229b8..ada542629a3202e26e5887073a08da784b2cbf25 100644 (file)
@@ -5187,6 +5187,8 @@ connection_finished_flushing(connection_t *conn)
       return connection_dir_finished_flushing(TO_DIR_CONN(conn));
     case CONN_TYPE_CONTROL:
       return connection_control_finished_flushing(TO_CONTROL_CONN(conn));
+    case CONN_TYPE_METRICS:
+      return metrics_connection_finished_flushing(conn);
     default:
       log_err(LD_BUG,"got unexpected conn type %d.", conn->type);
       tor_fragile_assert();
index 7a77ab11043ae90368ea615e9a193d3bf6634713..9a72fe714509dd22262157e78852a89ee6194cd8 100644 (file)
@@ -258,6 +258,15 @@ metrics_connection_reached_eof(connection_t *conn)
   return 0;
 }
 
+/** Called when conn has no more bytes left on its outbuf. Return 0 indicating
+ * success. */
+int
+metrics_connection_finished_flushing(connection_t *conn)
+{
+  tor_assert(conn);
+  return 0;
+}
+
 /** Initialize the subsystem. */
 void
 metrics_init(void)
index 858722de59c187d3f69d2cfbc7c7325f560e7cfb..e072519d10996c8fd980af4e3e60fd7d7b4c1ccd 100644 (file)
@@ -28,6 +28,7 @@ buf_t *metrics_get_output(const metrics_format_t fmt);
 /* Connection. */
 int metrics_connection_process_inbuf(struct connection_t *conn);
 int metrics_connection_reached_eof(struct connection_t *conn);
+int metrics_connection_finished_flushing(struct connection_t *conn);
 
 /* Configuration. */
 int metrics_parse_ports(or_options_t *options, smartlist_t *ports,