[tor-commits] [tor/master] Congratulate relay operator when OR is first started

nickm at torproject.org nickm at torproject.org
Tue Oct 28 18:04:05 UTC 2014


commit 36e771628eb77f9eb4101517b761c8dc652ff037
Author: rl1987 <rl1987 at sdf.lonestar.org>
Date:   Sun Oct 26 21:51:35 2014 +0200

    Congratulate relay operator when OR is first started
    
    When Tor first generates identity keypair, emit a log message that
    thanks for their participation and points to new Tor relay lifecycle
    document.
---
 changes/ticket10427 |    4 ++++
 src/or/router.c     |   21 +++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/changes/ticket10427 b/changes/ticket10427
new file mode 100644
index 0000000..66af284
--- /dev/null
+++ b/changes/ticket10427
@@ -0,0 +1,4 @@
+  o Minor features:
+    - When identity keypair is generated for first time, log a 
+      congratulatory message that points to new relay lifecycle
+      document. Implements feature 10427.
diff --git a/src/or/router.c b/src/or/router.c
index bbbf9c4..b202554 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -381,6 +381,26 @@ rotate_onion_key(void)
   tor_free(fname_prev);
 }
 
+/** Log greeting message that points to new relay lifecycle document the
+ * first time this function has been called.
+ */
+static void
+log_new_relay_greeting(void)
+{
+  static int already_logged = 0;
+
+  if (already_logged)
+    return;
+
+  tor_log(LOG_NOTICE, LD_GENERAL, "You are running a new relay. "
+         "Thanks for helping the Tor network! If you wish to know "
+         "what will happen in the upcoming weeks regarding its usage, "
+         "have a look at https://blog.torproject.org/blog/lifecycle-of"
+         "-a-new-relay");
+
+  already_logged = 1;
+}
+
 /** Try to read an RSA key from <b>fname</b>.  If <b>fname</b> doesn't exist
  * and <b>generate</b> is true, create a new RSA key and save it in
  * <b>fname</b>.  Return the read/created key, or NULL on error.  Log all
@@ -425,6 +445,7 @@ init_key_from_file(const char *fname, int generate, int severity)
           goto error;
         }
         log_info(LD_GENERAL, "Generated key seems valid");
+        log_new_relay_greeting();
         if (crypto_pk_write_private_key_to_filename(prkey, fname)) {
           tor_log(severity, LD_FS,
               "Couldn't write generated key to \"%s\".", fname);





More information about the tor-commits mailing list