[tor-commits] [tor/master] Use END_CIRC_REASON_TORPROTOCOL instead of magic number.

nickm at torproject.org nickm at torproject.org
Mon Dec 8 17:41:56 UTC 2014


commit 9c239eccc973042cbaec16fd48a457f44aeafc24
Author: rl1987 <rl1987 at sdf.lonestar.org>
Date:   Sun Dec 7 15:47:09 2014 +0200

    Use END_CIRC_REASON_TORPROTOCOL instead of magic number.
---
 changes/bug13840         |    3 +++
 src/or/connection_edge.c |    4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/changes/bug13840 b/changes/bug13840
new file mode 100644
index 0000000..a7204e4
--- /dev/null
+++ b/changes/bug13840
@@ -0,0 +1,3 @@
+  o Code simplifications and refactoring:
+    - In connection_exit_begin_conn(), use END_CIRC_REASON_TORPROTOCOL
+      constant instead of hardcoded value. Fixes issue 13840.
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 14b3911..9ace375 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -2461,7 +2461,7 @@ connection_exit_begin_conn(cell_t *cell, circuit_t *circ)
 
   relay_header_unpack(&rh, cell->payload);
   if (rh.length > RELAY_PAYLOAD_SIZE)
-    return -1;
+    return -END_CIRC_REASON_TORPROTOCOL;
 
   /* Note: we have to use relay_send_command_from_edge here, not
    * connection_edge_end or connection_edge_send_command, since those require
@@ -2479,7 +2479,7 @@ connection_exit_begin_conn(cell_t *cell, circuit_t *circ)
 
   r = begin_cell_parse(cell, &bcell, &end_reason);
   if (r < -1) {
-    return -1;
+    return -END_CIRC_REASON_TORPROTOCOL;
   } else if (r == -1) {
     tor_free(bcell.address);
     relay_send_end_cell_from_edge(rh.stream_id, circ, end_reason, NULL);



More information about the tor-commits mailing list