From eaf8b6f23f0f7f7832c33eb4c773d1b5ab6d6692 Mon Sep 17 00:00:00 2001 From: Norbert Schulz Date: Sun, 3 Nov 2024 14:06:28 +0100 Subject: [PATCH] ROS2 TCP: Improve fix comments review feedback --- lib/APPTurtle/src/Transports/CustomRosTransportTcp.cpp | 7 ++++--- lib/APPTurtle/src/Transports/CustomRosTransportTcp.h | 2 +- lib/WiFiNative/src/WifiClient.cpp | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/APPTurtle/src/Transports/CustomRosTransportTcp.cpp b/lib/APPTurtle/src/Transports/CustomRosTransportTcp.cpp index 03aafe91..1c3c9137 100644 --- a/lib/APPTurtle/src/Transports/CustomRosTransportTcp.cpp +++ b/lib/APPTurtle/src/Transports/CustomRosTransportTcp.cpp @@ -148,7 +148,7 @@ size_t CustomRosTransportTcp::read(uint8_t* buffer, size_t size, int timeout, ui { bool loop = true; - /** + /* * Run receive state machine. * The read function relationships are: * @@ -159,9 +159,10 @@ size_t CustomRosTransportTcp::read(uint8_t* buffer, size_t size, int timeout, ui if (InputState::INPUT_STATE_MAX > m_inputState) { - ReadFunc stateReadFunc = m_readFunction[m_inputState]; /**< Get state dependend input reader. */ + /* Get state dependend input reader function. */ + ReadFunc stateReadFunc = m_readFunction[m_inputState]; - /* Read state dependend message portion. */ + /* Read message portion based on reveiver state. */ loop = (this->*stateReadFunc)(timeout, errorCode); } else diff --git a/lib/APPTurtle/src/Transports/CustomRosTransportTcp.h b/lib/APPTurtle/src/Transports/CustomRosTransportTcp.h index b9699cb8..05f38699 100644 --- a/lib/APPTurtle/src/Transports/CustomRosTransportTcp.h +++ b/lib/APPTurtle/src/Transports/CustomRosTransportTcp.h @@ -231,7 +231,7 @@ class CustomRosTransportTcp : public CustomRosTransportBase * @param[in] timeout Read timout in milliseconds. * @param[out] errorCode Read error code if != 0 * - * return true if state machine shall reloop. + * @return true if state machine shall reloop. */ typedef bool (CustomRosTransportTcp::*ReadFunc)(int timeout, uint8_t* errorCode); diff --git a/lib/WiFiNative/src/WifiClient.cpp b/lib/WiFiNative/src/WifiClient.cpp index f24c94b3..a3649646 100644 --- a/lib/WiFiNative/src/WifiClient.cpp +++ b/lib/WiFiNative/src/WifiClient.cpp @@ -63,6 +63,9 @@ uint8_t WiFiClient::connect(const IPAddress& addr, uint16_t port) if (0U != connected()) { + /* Connect is called on an already connected client. + * Handle it as re-connect by closing the former socket connection. + */ stop(); }