openziti / ziti-sdk-py

Ziti SDK for Python
Apache License 2.0
70 stars 2 forks source link

Monkeypatch affecting MQTT connections #30

Closed natashell666 closed 2 years ago

natashell666 commented 2 years ago

After monkeypatching for doing a ziti connection using paho.mqtt.client (or any MQTT library), the connection fails with the following error:

Traceback (most recent call last):
  File "DemoMTTQ.py", line 466, in <module>
    listen_for_messages()
  File "DemoMTTQ.py", line 264, in listen_for_messages
    client = get_client()
  File "DemoMTTQ.py", line 147, in get_client
    client = mqtt.Client(client_id=client_id)
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 519, in __init__
    self._sockpairR, self._sockpairW = _socketpair_compat()
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 244, in _socketpair_compat
    listensock.bind(("127.0.0.1", 0))
  File "/usr/local/lib/python3.9/site-packages/openziti/zitisock.py", line 58, in bind
    bindings = self._ziti_opts['bindings']
KeyError: 'bindings'
Exception ignored in: <function Client.__del__ at 0x7f2e696ac790>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 603, in __del__
    self._reset_sockets()
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 649, in _reset_sockets
    if self._sockpairR:
AttributeError: 'Client' object has no attribute '_sockpairR'

Edit: reformatted traceback block -ekoby