Beckhoff / ADS

Beckhoff protocol to communicate with TwinCAT devices.
MIT License
519 stars 197 forks source link

fix: Do not hold global lock during connect #211

Closed nicolatimeus closed 1 year ago

nicolatimeus commented 1 year ago

In the current implementation AmsRouter::AddRoute performs a connect() call holding the global lock https://github.com/Beckhoff/ADS/blob/0499e45c49e530133ee8386eabbed1da9eebaf18/AdsLib/standalone/AmsRouter.cpp#L54. This blocks all operations on all routes until the connection attempt finishes, this can be undesirable if the connect call takes a long time to complete (for example if a timeout occurs), causing issue #208.

This PR implements a more fine-grained locking approach that allows operations on different routes to be performed concurrently, operations on the same route should behave in the same way as the current version.

Closes #208

pbruenn commented 1 year ago

was merged as https://github.com/Beckhoff/ADS/commit/8e8fb2a9acff06cc617f351ea35dbb9e56f0cf97