opcua icon indicating copy to clipboard operation
opcua copied to clipboard

[#189]: Fix detecting of failed connection

Open ctron opened this issue 3 years ago • 2 comments

The client failed to detect a broken connection, as it didn't react on a write error, aside from logging it.

This change makes it set the connection to finished when a write error occurs, which will trigger a re-connect.

However, due to the fact that in a single session actually two Tokio runtimes are involved, the session drops a Tokio runtime from an async context, which will panic.

In order to fix this, this PR also removes the explicit Tokio runtimes from the TCP comms and session struct. This means a breaking change, as now the client functions need to be called with an active Tokio context. This is easy as using #[tokio::main] and Handle::spawn_blocking for the synchronous functions, but might involve some more work in other scenarios.

fixes #189

ctron avatar Apr 22 '22 09:04 ctron

Unfortunately there was no "0.10" branch, so this PR failed to merge with master.

ctron avatar Apr 22 '22 09:04 ctron

@ctron maybe you can checkout this branch: https://github.com/svanharmelen/opcua/tree/feature/async-client it's intended to become a full async-client. I did run and test it a little, but not enough yet to create a PR for it to this repo...

EDIT: I will create a draft PR to create awareness (#197)

svanharmelen avatar Apr 22 '22 10:04 svanharmelen