epics-modules / twincat-ads

GNU Lesser General Public License v3.0
4 stars 3 forks source link

adsAsynPortDriver.cpp: Improve logging when adsReadStateLock fails #20

Closed tboegi closed 1 week ago

tboegi commented 1 week ago

There was not really much information when adsReadStateLock() failed. One case was that the crate was run with a test-license, which had expired. Improve this a little bit by printing the error code.

Keep the loop to disconnect, reconnect and try again, to be able to recover some day. Make it less spammy by adding a sleep(10 seconds).

mac-kan commented 1 week ago

It's quite a long sleep. Otherwise looks good.

tboegi commented 1 week ago

Note that this is a totaly useless configuration on the PLC side. The only thing that is happening on the IOC is a repeated log. I think that 10 seconds are even short, since no PLC programmer does fix this within 10 seconds.

mac-kan commented 1 week ago

Well, during development the connection might go down because of a simple update of the program on the PLC. That kind of restart will most likely be quite fast and a 10 s delay in worst case could be of annoyance.

tboegi commented 1 week ago

I keep this PR open for more testing. The reason for this is that it does not make any sense to hammer a connection/connect() every 2 seconds followed by a "connection closed by remote". In this case there is something seriously wrong.

tboegi commented 1 week ago

I think all review comments are addressed- thanks for the review