Skip to content

Commit

Permalink
[border-agent] remove unused GetUdpProxyPort() method (openthread#1…
Browse files Browse the repository at this point in the history
…1086)

This commit removes the unused `GetUdpProxyPort()` method and the
related code tracking the proxy port in `BorderAgent`.
  • Loading branch information
abtink authored Dec 26, 2024
1 parent 2e39577 commit 1063090
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
11 changes: 3 additions & 8 deletions src/core/meshcop/border_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -135,8 +134,7 @@ Error BorderAgent::Start(uint16_t aUdpPort, const uint8_t *aPsk, uint8_t aPskLen

Get<Tmf::SecureAgent>().SetConnectCallback(HandleConnected, this);

mState = kStateStarted;
mUdpProxyPort = 0;
mState = kStateStarted;

LogInfo("Border Agent start listening on port %u", GetUdpPort());

Expand All @@ -161,8 +159,7 @@ void BorderAgent::Stop(void)
mTimer.Stop();
Get<Tmf::SecureAgent>().Close();

mState = kStateStopped;
mUdpProxyPort = 0;
mState = kStateStopped;
LogInfo("Border Agent stopped");

exit:
Expand Down Expand Up @@ -280,8 +277,7 @@ void BorderAgent::HandleConnected(Dtls::Session::ConnectEvent aEvent)
else
#endif
{
mState = kStateStarted;
mUdpProxyPort = 0;
mState = kStateStarted;

if (aEvent == Dtls::Session::kDisconnectedError)
{
Expand Down Expand Up @@ -639,7 +635,6 @@ template <> void BorderAgent::HandleTmf<kUriProxyTx>(Coap::Message &aMessage, co
SuccessOrExit(error = Tlv::Find<Ip6AddressTlv>(aMessage, messageInfo.GetPeerAddr()));

SuccessOrExit(error = Get<Ip6::Udp>().SendDatagram(*message, messageInfo));
mUdpProxyPort = udpEncapHeader.GetSourcePort();

LogInfo("Proxy transmit sent to %s", messageInfo.GetPeerAddr().ToString().AsCString());

Expand Down
9 changes: 0 additions & 9 deletions src/core/meshcop/border_agent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,6 @@ class BorderAgent : public InstanceLocator, private NonCopyable
*/
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");
Expand Down Expand Up @@ -323,7 +315,6 @@ class BorderAgent : public InstanceLocator, private NonCopyable
#endif

State mState;
uint16_t mUdpProxyPort;
Ip6::Udp::Receiver mUdpReceiver;
Ip6::Netif::UnicastAddress mCommissionerAloc;
TimeoutTimer mTimer;
Expand Down

0 comments on commit 1063090

Please sign in to comment.