-
Couldn't load subscription status.
- Fork 13
Fix SSL and set_socket #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,7 +112,7 @@ def _connect_to_mqtt(self) -> None: | |
| " - device_registration :: connect :: created mqtt client. connecting.." | ||
| ) | ||
| while not self._auth_response_received: | ||
| self._mqtt.loop() | ||
| self._mqtt.loop(2) | ||
|
|
||
| self._logger.info( | ||
| " - device_registration :: connect :: on_connect must be fired. Connected ?" | ||
|
|
@@ -139,7 +139,7 @@ def _start_registration(self) -> None: | |
| while self._operation_id is None and retry < 10: | ||
| time.sleep(1) | ||
| retry += 1 | ||
| self._mqtt.loop() | ||
| self._mqtt.loop(2) | ||
|
|
||
| if self._operation_id is None: | ||
| raise DeviceRegistrationError( | ||
|
|
@@ -159,7 +159,7 @@ def _wait_for_operation(self) -> None: | |
| while self._hostname is None and retry < 10: | ||
| time.sleep(1) | ||
| retry += 1 | ||
| self._mqtt.loop() | ||
| self._mqtt.loop(2) | ||
|
|
||
| if self._hostname is None: | ||
| raise DeviceRegistrationError( | ||
|
|
@@ -194,15 +194,15 @@ def register_device(self, expiry: int) -> str: | |
| "&skn=registration" | ||
| ) | ||
|
|
||
| MQTT.set_socket(self._socket, self._iface) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed since |
||
|
|
||
| self._mqtt = MQTT.MQTT( | ||
| broker=constants.DPS_END_POINT, | ||
| port=8883, | ||
| username=username, | ||
| password=auth_string, | ||
| port=8883, | ||
| keep_alive=120, | ||
| client_id=self._device_id, | ||
| is_ssl=True, | ||
| keep_alive=120, | ||
| socket_pool=self._socket, | ||
| ssl_context=ssl.create_default_context(), | ||
| ) | ||
|
Comment on lines
197
to
207
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are added because
MiniMQTTwill throw when the loop timeout is less then the socket_timeout, which defaults to1here