Skip to content

IsoTPSocketConnection can not be closed with tpsock in blocking mode #191

@bacarz

Description

@bacarz

Closing IsoTPSocketConnection stucks on self.rxthread.join() when self.tpsock is created in blocking mode:

    tpsock = isotp.socket(timeout=0)
    connector = IsoTPSocketConnection(interface=interface, rxid=endpoint.tx, txid=endpoint.rx, tpsock=tpsock)

rxthread_task use directly socket.recv by self.tpsock.recv() . Is it possible to use selector?

    def rxthread_task(self):
        sel = selectors.DefaultSelector()
        sel.register(self.tpsock, selectors.EVENT_READ, data=None)
        while not self.exit_requested:
            events = sel.select(timeout=1)
            for _, _ in events:
                try:
                    data = self.tpsock.recv()
                    if data is not None:
                        self.rxqueue.put(data)
                except socket.timeout:
                    pass
                except Exception:
                    self.exit_requested = True

Or it would be better to make some changes to isotp.socket.recv directly?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions