mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:06:05 -04:00
Use getClientAddress
instead of getClientIP
. (#12599)
getClientIP was deprecated in Twisted 18.4.0, which also added getClientAddress. The Synapse minimum version for Twisted is currently 18.9.0, so all supported versions have the new API.
This commit is contained in:
parent
116a4c8340
commit
7fbf42499d
16 changed files with 62 additions and 46 deletions
|
@ -181,7 +181,7 @@ class FakeChannel:
|
|||
self.resource_usage = _self.logcontext.get_resource_usage()
|
||||
|
||||
def getPeer(self):
|
||||
# We give an address so that getClientIP returns a non null entry,
|
||||
# We give an address so that getClientAddress/getClientIP returns a non null entry,
|
||||
# causing us to record the MAU
|
||||
return address.IPv4Address("TCP", self._ip, 3423)
|
||||
|
||||
|
@ -562,7 +562,10 @@ class FakeTransport:
|
|||
"""
|
||||
|
||||
_peer_address: Optional[IAddress] = attr.ib(default=None)
|
||||
"""The value to be returend by getPeer"""
|
||||
"""The value to be returned by getPeer"""
|
||||
|
||||
_host_address: Optional[IAddress] = attr.ib(default=None)
|
||||
"""The value to be returned by getHost"""
|
||||
|
||||
disconnecting = False
|
||||
disconnected = False
|
||||
|
@ -571,11 +574,11 @@ class FakeTransport:
|
|||
producer = attr.ib(default=None)
|
||||
autoflush = attr.ib(default=True)
|
||||
|
||||
def getPeer(self):
|
||||
def getPeer(self) -> Optional[IAddress]:
|
||||
return self._peer_address
|
||||
|
||||
def getHost(self):
|
||||
return None
|
||||
def getHost(self) -> Optional[IAddress]:
|
||||
return self._host_address
|
||||
|
||||
def loseConnection(self, reason=None):
|
||||
if not self.disconnecting:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue