You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The peers table is responsible for generating RemotePeer objetcs. RemotePeer is responsible for (amongst other things) working out which replication url to use.
We'll use the port defined in the configuration url (possibly 443 implicitly)
If there's no replication url configured, we'll use the port provided in the call to RemotePeer.__init__
If port is Falsey then use 1001; else use
After this, the only uses of port and self.port are for logging. We always log with %d, so expect this to be an integer.
There is a path here where you can do a bad thing.
Don't configure any base replication urls
Add an entry to peers with a NULL port
Every call to RemotePeer will try to format None as an integer, which will raise a TypeError.
>>> "%d" % None
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: %d format: a number is required, not NoneType
Equally, if we did specify a port in the DB and did provide a replication URL, the db's port would be ignored, but the logging would continue to print it anyway!
Fix this by logging the base replication url so we don't have any need for the port.
The text was updated successfully, but these errors were encountered:
It's niche, but if no replication base url was configured and a peer was
configured with a NULL port in the db, then we would try to format None
as an integer and get a TypeError for our troubles.
Spotted by work in progress elsewhere to make Sydent pass mypy --strict.
Fixes#419.
It's niche, but if no replication base url was configured and a peer was
configured with a NULL port in the db, then we would try to format None
as an integer and get a TypeError for our troubles.
Spotted by work in progress elsewhere to make Sydent pass mypy --strict.
Fixes#419.
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
The
peers
table is responsible for generatingRemotePeer
objetcs.RemotePeer
is responsible for (amongst other things) working out which replication url to use.RemotePeer.__init__
After this, the only uses of
port
andself.port
are for logging. We always log with%d
, so expect this to be an integer.There is a path here where you can do a bad thing.
peers
with a NULL portNone
as an integer, which will raise a TypeError.Equally, if we did specify a port in the DB and did provide a replication URL, the db's port would be ignored, but the logging would continue to print it anyway!
Fix this by logging the base replication url so we don't have any need for the port.
The text was updated successfully, but these errors were encountered: