Skip to content

Commit

Permalink
Disbale upnp by default
Browse files Browse the repository at this point in the history
  • Loading branch information
mariano54 committed Nov 25, 2019
1 parent 6f4831d commit 0cefcc8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ pip-delete-this-directory.txt
# mypy
.mypy_cache/

# Editors
.vscode

# Packaging
chia-blockchain.tar.gz
7 changes: 4 additions & 3 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ full_node:
# The full node server (if run) will run on this host and port
host: 127.0.0.1
port: 8444
enable_upnp: False
# Don't send any more than these number of headers and blocks, in one message
max_headers_to_send: 100
max_blocks_to_send: 10
Expand All @@ -68,11 +69,11 @@ full_node:
host: 127.0.0.1
port: 8446
introducer_peer:
host: 127.0.0.1
# host: 127.0.0.1
# host: 216.39.16.173
# host: 2001:470:82f3:20:d250:99ff:fed1:5797
# host: 2600:1f18:63ed:e200:f7c5:9e28:9b5e:130
port: 8445
host: 2600:1f18:63ed:e200:f7c5:9e28:9b5e:130
port: 8444

introducer:
host: 127.0.0.1
Expand Down
1 change: 1 addition & 0 deletions src/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ async def perform_handshake(
InvalidHandshake,
asyncio.IncompleteReadError,
ConnectionResetError,
Exception,
) as e:
log.warning(f"{e}, handshake not completed. Connection not created.")
connection.close()
Expand Down
17 changes: 9 additions & 8 deletions src/server/start_full_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ async def main():
# Starts the full node server (which full nodes can connect to)
host, port = parse_host_port(full_node)

try:
upnp = miniupnpc.UPnP()
upnp.discoverdelay = 10
upnp.discover()
upnp.selectigd()
upnp.addportmapping(port, "TCP", upnp.lanaddr, port, "chia", "")
except Exception as e:
log.warning(f"UPnP failed: {e}")
if full_node.config["enable_upnp"]:
try:
upnp = miniupnpc.UPnP()
upnp.discoverdelay = 10
upnp.discover()
upnp.selectigd()
upnp.addportmapping(port, "TCP", upnp.lanaddr, port, "chia", "")
except Exception as e:
log.warning(f"UPnP failed: {e}")

server = ChiaServer(port, full_node, NodeType.FULL_NODE)
full_node._set_server(server)
Expand Down

0 comments on commit 0cefcc8

Please sign in to comment.