[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Drop AUTHDIR_NEWDESCS events



commit 7e3e814e99846d4554412bb32b5d8c06fdf1b8ed
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Feb 1 15:21:56 2020 -0800

    Drop AUTHDIR_NEWDESCS events
    
    Tor removed this event type. Now we can drop it on our end too.
---
 stem/control.py              |  7 -------
 stem/response/events.py      | 37 -------------------------------------
 test/unit/response/events.py | 15 ---------------
 3 files changed, 59 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index 5501d1c8..e48f6bcd 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -182,16 +182,10 @@ If you're fine with allowing your script to raise exceptions then this can be mo
   Enums are mapped to :class:`~stem.response.events.Event` subclasses as
   follows...
 
-  .. deprecated:: 1.6.0
-
-     Tor dropped EventType.AUTHDIR_NEWDESCS as of version 0.3.2.1.
-     (:spec:`6e887ba`)
-
   ======================= ===========
   EventType               Event Class
   ======================= ===========
   **ADDRMAP**             :class:`stem.response.events.AddrMapEvent`
-  **AUTHDIR_NEWDESCS**    :class:`stem.response.events.AuthDirNewDescEvent`
   **BUILDTIMEOUT_SET**    :class:`stem.response.events.BuildTimeoutSetEvent`
   **BW**                  :class:`stem.response.events.BandwidthEvent`
   **CELL_STATS**          :class:`stem.response.events.CellStatsEvent`
@@ -291,7 +285,6 @@ State = stem.util.enum.Enum('INIT', 'RESET', 'CLOSED')
 
 EventType = stem.util.enum.UppercaseEnum(
   'ADDRMAP',
-  'AUTHDIR_NEWDESCS',
   'BUILDTIMEOUT_SET',
   'BW',
   'CELL_STATS',
diff --git a/stem/response/events.py b/stem/response/events.py
index 9b6d8393..3f43cfbd 100644
--- a/stem/response/events.py
+++ b/stem/response/events.py
@@ -223,42 +223,6 @@ class AddrMapEvent(Event):
         raise stem.ProtocolError("An ADDRMAP event's CACHED mapping can only be 'YES' or 'NO': %s" % self)
 
 
-class AuthDirNewDescEvent(Event):
-  """
-  Event specific to directory authorities, indicating that we just received new
-  descriptors. The descriptor type contained within this event is unspecified
-  so the descriptor contents are left unparsed.
-
-  The AUTHDIR_NEWDESCS event was introduced in tor version 0.1.1.10-alpha and
-  removed in 0.3.2.1-alpha. (:spec:`6e887ba`)
-
-  .. deprecated:: 1.6.0
-     Tor dropped this event as of version 0.3.2.1. (:spec:`6e887ba`)
-
-  :var stem.AuthDescriptorAction action: what is being done with the descriptor
-  :var str message: explanation of why we chose this action
-  :var str descriptor: content of the descriptor
-  """
-
-  _SKIP_PARSING = True
-  _VERSION_ADDED = stem.version.Requirement.EVENT_AUTHDIR_NEWDESCS
-
-  def _parse(self):
-    lines = str(self).split('\n')
-
-    if len(lines) < 5:
-      raise stem.ProtocolError("AUTHDIR_NEWDESCS events must contain lines for at least the type, action, message, descriptor, and terminating 'OK'")
-    elif lines[-1] != 'OK':
-      raise stem.ProtocolError("AUTHDIR_NEWDESCS doesn't end with an 'OK'")
-
-    # TODO: For stem 2.0.0 we should consider changing 'descriptor' to a
-    # ServerDescriptor instance.
-
-    self.action = lines[1]
-    self.message = lines[2]
-    self.descriptor = '\n'.join(lines[3:-1])
-
-
 class BandwidthEvent(Event):
   """
   Event emitted every second with the bytes sent and received by tor.
@@ -1386,7 +1350,6 @@ def _parse_cell_type_mapping(mapping):
 
 EVENT_TYPE_TO_CLASS = {
   'ADDRMAP': AddrMapEvent,
-  'AUTHDIR_NEWDESCS': AuthDirNewDescEvent,
   'BUILDTIMEOUT_SET': BuildTimeoutSetEvent,
   'BW': BandwidthEvent,
   'CELL_STATS': CellStatsEvent,
diff --git a/test/unit/response/events.py b/test/unit/response/events.py
index 8e2512bd..46503287 100644
--- a/test/unit/response/events.py
+++ b/test/unit/response/events.py
@@ -640,21 +640,6 @@ class TestEvents(unittest.TestCase):
     # the CACHED argument should only allow YES or NO
     self.assertRaises(ProtocolError, _get_event, ADDRMAP_CACHED_MALFORMED)
 
-  def test_authdir_newdesc_event(self):
-    minimal_event = _get_event('650+AUTHDIR_NEWDESCS\nAction\nMessage\nDescriptor\n.\n650 OK\n')
-
-    self.assertTrue(isinstance(minimal_event, stem.response.events.AuthDirNewDescEvent))
-    self.assertEqual('Action', minimal_event.action)
-    self.assertEqual('Message', minimal_event.message)
-    self.assertEqual('Descriptor', minimal_event.descriptor)
-
-    event = _get_event(AUTHDIR_NEWDESC)
-
-    self.assertTrue(isinstance(event, stem.response.events.AuthDirNewDescEvent))
-    self.assertEqual('DROPPED', event.action)
-    self.assertEqual('Not replacing router descriptor; no information has changed since the last one with this identity.', event.message)
-    self.assertTrue('Descripto', event.descriptor.startswith('@uploaded-at 2017-05-25 04:46:21'))
-
   def test_build_timeout_set_event(self):
     event = _get_event(BUILD_TIMEOUT_EVENT)
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits