Skip to content

Add ThreadSafeClient implementation#203

Open
PaulWasTaken wants to merge 3 commits intopython-smpplib:masterfrom
PaulWasTaken:feature/thread-safe-client
Open

Add ThreadSafeClient implementation#203
PaulWasTaken wants to merge 3 commits intopython-smpplib:masterfrom
PaulWasTaken:feature/thread-safe-client

Conversation

@PaulWasTaken
Copy link

I based it on #187.
Hope nobody minds)

@PaulWasTaken PaulWasTaken force-pushed the feature/thread-safe-client branch from 097d6f3 to 8faa88f Compare July 11, 2022 08:45
Copy link

@m4rtinpf m4rtinpf left a comment

Choose a reason for hiding this comment

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

Awesome idea!

Built something with this library a while back and had some issues with it being thread-unsafe.

def send_pdu(self, pdu, send_later=False) -> bool:
if send_later:
self._send_queue.append(pdu)
self._send_sock.send(b'\x00')
Copy link

Choose a reason for hiding this comment

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

Why are we sending a 00? Is it a no-op? If so, why are we sending it?

Copy link
Author

Choose a reason for hiding this comment

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

It is some sort of notification frame. We put it into the send socket to wake up our read socket

@PaulWasTaken PaulWasTaken force-pushed the feature/thread-safe-client branch from 3600d48 to 455c19d Compare April 25, 2023 14:04
@PaulWasTaken
Copy link
Author

@eigenein FYI


if not rlist:
if self._should_prolong_session():
if not auto_send_enquire_link:
Copy link
Author

Choose a reason for hiding this comment

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

TODO: check auto_send_enquire_link before self._should_prolong_session() call

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