diff --git a/platformio/__init__.py b/platformio/__init__.py index 6f17439e..38135902 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -35,4 +35,4 @@ __copyright__ = "Copyright 2014-present PlatformIO" __apiurl__ = "https://api.platformio.org" __pioaccount_api__ = "https://api.accounts.platformio.org" -__pioremote_endpoint__ = "ssl:remote.platformio.org:4413" +__pioremote_endpoint__ = "ssl:host=remote.platformio.org:port=4413" diff --git a/platformio/commands/remote/client/base.py b/platformio/commands/remote/client/base.py index 5e0591eb..806d7bda 100644 --- a/platformio/commands/remote/client/base.py +++ b/platformio/commands/remote/client/base.py @@ -73,15 +73,26 @@ class RemoteClientBase( # pylint: disable=too-many-instance-attributes def connect(self): self.log.info("Name: {name}", name=self.name) self.log.info("Connecting to PIO Remote Cloud") - endpoint = endpoints.clientFromString(reactor, __pioremote_endpoint__) + + # pylint: disable=protected-access + proto, options = endpoints._parse(__pioremote_endpoint__) + proto = proto[0] + factory = RemoteClientFactory() factory.remote_client = self factory.sslContextFactory = None - if __pioremote_endpoint__.startswith("ssl:"): - # pylint: disable=protected-access - factory.sslContextFactory = SSLContextFactory(endpoint._host) - endpoint._sslContextFactory = factory.sslContextFactory - endpoint.connect(factory) + if proto == "ssl": + factory.sslContextFactory = SSLContextFactory(options["host"]) + reactor.connectSSL( + options["host"], + int(options["port"]), + factory, + factory.sslContextFactory, + ) + elif proto == "tcp": + reactor.connectTCP(options["host"], int(options["port"]), factory) + else: + raise exception.PlatformioException("Unknown PIO Remote Cloud protocol") reactor.run() if self._exit_code != 0: