mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-16 06:51:46 +01:00
Fix ClientReplicationStreamProtocol.__str__ (#4929)
`__str__` depended on `self.addr`, which was absent from ClientReplicationStreamProtocol, so attempting to call str on such an object would raise an exception. We can calculate the peer addr from the transport, so there is no need for addr anyway.
This commit is contained in:
parent
9bde730ef8
commit
8cbbedaa2b
3 changed files with 6 additions and 4 deletions
1
changelog.d/4929.misc
Normal file
1
changelog.d/4929.misc
Normal file
|
@ -0,0 +1 @@
|
|||
Fix `ClientReplicationStreamProtocol.__str__()`.
|
|
@ -375,8 +375,11 @@ class BaseReplicationStreamProtocol(LineOnlyReceiver):
|
|||
self.transport.unregisterProducer()
|
||||
|
||||
def __str__(self):
|
||||
addr = None
|
||||
if self.transport:
|
||||
addr = str(self.transport.getPeer())
|
||||
return "ReplicationConnection<name=%s,conn_id=%s,addr=%s>" % (
|
||||
self.name, self.conn_id, self.addr,
|
||||
self.name, self.conn_id, addr,
|
||||
)
|
||||
|
||||
def id(self):
|
||||
|
@ -392,12 +395,11 @@ class ServerReplicationStreamProtocol(BaseReplicationStreamProtocol):
|
|||
VALID_INBOUND_COMMANDS = VALID_CLIENT_COMMANDS
|
||||
VALID_OUTBOUND_COMMANDS = VALID_SERVER_COMMANDS
|
||||
|
||||
def __init__(self, server_name, clock, streamer, addr):
|
||||
def __init__(self, server_name, clock, streamer):
|
||||
BaseReplicationStreamProtocol.__init__(self, clock) # Old style class
|
||||
|
||||
self.server_name = server_name
|
||||
self.streamer = streamer
|
||||
self.addr = addr
|
||||
|
||||
# The streams the client has subscribed to and is up to date with
|
||||
self.replication_streams = set()
|
||||
|
|
|
@ -57,7 +57,6 @@ class ReplicationStreamProtocolFactory(Factory):
|
|||
self.server_name,
|
||||
self.clock,
|
||||
self.streamer,
|
||||
addr
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue