mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Fix an issue when PIO Remote agent was not reconnected automatically
This commit is contained in:
@ -35,4 +35,4 @@ __copyright__ = "Copyright 2014-present PlatformIO"
|
|||||||
|
|
||||||
__apiurl__ = "https://api.platformio.org"
|
__apiurl__ = "https://api.platformio.org"
|
||||||
__pioaccount_api__ = "https://api.accounts.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"
|
||||||
|
@ -73,15 +73,26 @@ class RemoteClientBase( # pylint: disable=too-many-instance-attributes
|
|||||||
def connect(self):
|
def connect(self):
|
||||||
self.log.info("Name: {name}", name=self.name)
|
self.log.info("Name: {name}", name=self.name)
|
||||||
self.log.info("Connecting to PIO Remote Cloud")
|
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 = RemoteClientFactory()
|
||||||
factory.remote_client = self
|
factory.remote_client = self
|
||||||
factory.sslContextFactory = None
|
factory.sslContextFactory = None
|
||||||
if __pioremote_endpoint__.startswith("ssl:"):
|
if proto == "ssl":
|
||||||
# pylint: disable=protected-access
|
factory.sslContextFactory = SSLContextFactory(options["host"])
|
||||||
factory.sslContextFactory = SSLContextFactory(endpoint._host)
|
reactor.connectSSL(
|
||||||
endpoint._sslContextFactory = factory.sslContextFactory
|
options["host"],
|
||||||
endpoint.connect(factory)
|
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()
|
reactor.run()
|
||||||
|
|
||||||
if self._exit_code != 0:
|
if self._exit_code != 0:
|
||||||
|
Reference in New Issue
Block a user