fix hashability of dilation objects

This commit is contained in:
Brian Warner 2019-02-10 15:57:39 -08:00
parent e4264971d7
commit 0c9d2c927a
4 changed files with 7 additions and 3 deletions

View File

@ -455,7 +455,7 @@ class _Record(object):
self._framer.send_frame(frame)
@attrs(hash=True)
@attrs(cmp=False)
class DilatedConnectionProtocol(Protocol, object):
"""I manage an L2 connection.

View File

@ -39,7 +39,7 @@ NOISEPROTO = b"Noise_NNpsk0_25519_ChaChaPoly_BLAKE2s"
def build_noise():
return NoiseConnection.from_name(NOISEPROTO)
@attrs(hash=True)
@attrs(cmp=False)
@implementer(IDilationConnector)
class Connector(object):
"""I manage a single generation of connection.

View File

@ -87,7 +87,7 @@ def make_side():
# * if follower calls w.dilate() but not leader, follower waits forever
# in "want", leader waits forever in "wanted"
@attrs(hash=True)
@attrs(cmp=False)
@implementer(IDilationManager)
class Manager(object):
_S = attrib(validator=provides(ISend), repr=False)

View File

@ -29,6 +29,10 @@ def make_con(role, use_relay=False):
class Connection(unittest.TestCase):
def test_hashable(self):
c, n, connector, t, eq = make_con(LEADER)
hash(c)
def test_bad_prologue(self):
c, n, connector, t, eq = make_con(LEADER)
c.makeConnection(t)