FactbirdHQ / mqttrust

MQTT client for embedded devices, written in rust
50 stars 5 forks source link

[Optional] Encapsulate network handling in NetworkHandle #25

Closed keisrk closed 3 years ago

keisrk commented 3 years ago

This PR is optional. A dedicated struct for network handling 1. makes conditions when disconnect is called explicit and 2. keeps the network_connect method from opening and force-updating even when a closed socket is present.

PR #24 introduces NetworkHandle, a struct wrapping TcpClient::TcpSocket to convince the borrow checker. By chance I found it was a nice place to organize network handling methods. This PR consists of 3 groups of commits. Cherry-picking some of them also makes me happy.