expose protocol class for tests to override

This commit is contained in:
Jack Robison 2022-07-28 12:02:47 -04:00
parent 08f25a7c50
commit bb6166c62d

View file

@ -204,7 +204,7 @@ class SessionManager:
self.notified_height: typing.Optional[int] = None self.notified_height: typing.Optional[int] = None
# Cache some idea of room to avoid recounting on each subscription # Cache some idea of room to avoid recounting on each subscription
self.subs_room = 0 self.subs_room = 0
self.protocol_class = LBRYElectrumX
self.session_event = Event() self.session_event = Event()
# Search index # Search index
@ -262,7 +262,7 @@ class SessionManager:
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
if kind == 'TCP': if kind == 'TCP':
protocol_class = LBRYElectrumX protocol_class = self.protocol_class
else: else:
raise ValueError(kind) raise ValueError(kind)
protocol_factory = partial(protocol_class, self, kind) protocol_factory = partial(protocol_class, self, kind)