Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #4537 from golemfactory/threaded_upnp
Browse files Browse the repository at this point in the history
Start UPnP discovery and mapping in a separate thread
  • Loading branch information
mfranciszkiewicz authored Jul 25, 2019
2 parents e96da0c + 150579d commit c5198e3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions golem/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
inlineCallbacks,
gatherResults,
Deferred)
from twisted.internet.threads import deferToThread

from apps.appsmanager import AppsManager
import golem
Expand Down Expand Up @@ -466,6 +467,7 @@ def start_network(self):
task_cleaner_service.start()
self._services.append(task_cleaner_service)

@inlineCallbacks
def connect(ports):
logger.info(
'Golem is listening on addr: %s'
Expand All @@ -476,10 +478,11 @@ def connect(ports):
self.node.hyperdrive_prv_port
)

ports = ports + list(hyperdrive_ports)
if self.config_desc.use_upnp:
self.start_upnp(ports + list(hyperdrive_ports))
self.node.update_public_info()
yield deferToThread(self.start_upnp, ports)

self.node.update_public_info()
public_ports = [
self.node.p2p_pub_port,
self.node.pub_port,
Expand Down

0 comments on commit c5198e3

Please # to comment.