From 106309081716d1cf6749ef5708c3cc841b146e6e Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Thu, 26 Dec 2024 12:41:34 -0800 Subject: [PATCH] [border-agent] remove unused `GetUdpProxyPort()` method (#11086) This commit removes the unused `GetUdpProxyPort()` method and the related code tracking the proxy port in `BorderAgent`. --- src/core/meshcop/border_agent.cpp | 11 +++-------- src/core/meshcop/border_agent.hpp | 9 --------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/core/meshcop/border_agent.cpp b/src/core/meshcop/border_agent.cpp index 8b926297a..5fcf60f12 100644 --- a/src/core/meshcop/border_agent.cpp +++ b/src/core/meshcop/border_agent.cpp @@ -48,7 +48,6 @@ RegisterLogModule("BorderAgent"); BorderAgent::BorderAgent(Instance &aInstance) : InstanceLocator(aInstance) , mState(kStateStopped) - , mUdpProxyPort(0) , mUdpReceiver(BorderAgent::HandleUdpReceive, this) , mTimer(aInstance) #if OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE @@ -135,8 +134,7 @@ Error BorderAgent::Start(uint16_t aUdpPort, const uint8_t *aPsk, uint8_t aPskLen Get().SetConnectCallback(HandleConnected, this); - mState = kStateStarted; - mUdpProxyPort = 0; + mState = kStateStarted; LogInfo("Border Agent start listening on port %u", GetUdpPort()); @@ -161,8 +159,7 @@ void BorderAgent::Stop(void) mTimer.Stop(); Get().Close(); - mState = kStateStopped; - mUdpProxyPort = 0; + mState = kStateStopped; LogInfo("Border Agent stopped"); exit: @@ -280,8 +277,7 @@ void BorderAgent::HandleConnected(Dtls::Session::ConnectEvent aEvent) else #endif { - mState = kStateStarted; - mUdpProxyPort = 0; + mState = kStateStarted; if (aEvent == Dtls::Session::kDisconnectedError) { @@ -639,7 +635,6 @@ template <> void BorderAgent::HandleTmf(Coap::Message &aMessage, co SuccessOrExit(error = Tlv::Find(aMessage, messageInfo.GetPeerAddr())); SuccessOrExit(error = Get().SendDatagram(*message, messageInfo)); - mUdpProxyPort = udpEncapHeader.GetSourcePort(); LogInfo("Proxy transmit sent to %s", messageInfo.GetPeerAddr().ToString().AsCString()); diff --git a/src/core/meshcop/border_agent.hpp b/src/core/meshcop/border_agent.hpp index e5de00b63..a597a1e24 100644 --- a/src/core/meshcop/border_agent.hpp +++ b/src/core/meshcop/border_agent.hpp @@ -247,14 +247,6 @@ public: */ const Counters &GetCounters(void) { return mCounters; } - /** - * Returns the UDP Proxy port to which the commissioner is currently - * bound. - * - * @returns The current UDP Proxy port or 0 if no Proxy Transmit has been received yet. - */ - uint16_t GetUdpProxyPort(void) const { return mUdpProxyPort; } - private: static_assert(kMaxEphemeralKeyLength <= Dtls::Transport::kPskMaxLength, "Max ephemeral key length is larger than max PSK len"); @@ -323,7 +315,6 @@ private: #endif State mState; - uint16_t mUdpProxyPort; Ip6::Udp::Receiver mUdpReceiver; Ip6::Netif::UnicastAddress mCommissionerAloc; TimeoutTimer mTimer;