ferrohd / mikrotik-rs

An asynchronous Rust library for interacting with MikroTik routers
https://crates.io/crates/mikrotik-rs
MIT License
3 stars 2 forks source link

Keep connection open while commands are still running #14

Closed gdyr closed 2 weeks ago

gdyr commented 3 weeks ago

Presently, the connection to a device is closed as soon as the command channel is closed.

However, a command channel may be closed by library users in a situation where a) there are no more commands to send, but b) there is still data to receive (e.g. from a long-running /listen command)

In this PR, the connection will stay alive until either a) a fatal error occurs, or TCP socket is closed by far end (as per existing "shutdown" cases), or b) both the command channel is closed, and all running_commands complete.