Skip to content

a connection without peer info should be rejected (#300)#304

Merged
HerrMuellerluedenscheid merged 2 commits intoYakifo:mainfrom
ajmirsky:bug_fix_300
Jan 6, 2026
Merged

a connection without peer info should be rejected (#300)#304
HerrMuellerluedenscheid merged 2 commits intoYakifo:mainfrom
ajmirsky:bug_fix_300

Conversation

@ajmirsky
Copy link
Copy Markdown
Collaborator

@ajmirsky ajmirsky commented Dec 8, 2025

Changes included in this PR

If a connection doesn't have information about the remote address or port, then the connection should fail gracefully

Fixed get_peer_info so that it checks for return value of get_extra_info before separating the address and port.

Checklist

  1. Does your submission pass the existing tests?
  2. Are there new tests that cover these additions/changes?
  3. Have you linted your code locally before submission?

@ajmirsky ajmirsky changed the title a connection without peer info should be rejected a connection without peer info should be rejected (#300) Dec 8, 2025
Comment thread tests/test_broker.py
with patch.object(asyncio.streams.StreamWriter, 'get_extra_info', return_value=None) as mock_extra_info:
with pytest.raises(ConnectError):
await client.connect("mqtt://127.0.0.1/")
await asyncio.sleep(0.01)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tests fail with timeout. I'm wondering if the rather short sleep could be one reason?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appreciate the suggestion!

didn't get a chance to debug yesterday, should have a fix later today

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HerrMuellerluedenscheid can you review when you get a chance?

@HerrMuellerluedenscheid HerrMuellerluedenscheid merged commit 05a25cb into Yakifo:main Jan 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants