Skip to content

Commit

Permalink
apply comments - add module LogError, remove mContext and mTransportC…
Browse files Browse the repository at this point in the history
…ontext
  • Loading branch information
pjasinski990 committed Sep 21, 2023
1 parent 28cc5f6 commit b5982b1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/core/meshcop/dtls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ Dtls::Dtls(Instance &aInstance, bool aLayerTwoSecurity, bool aDatagramTransport)
, mLayerTwoSecurity(aLayerTwoSecurity)
, mDatagramTransport(aDatagramTransport)
, mReceiveMessage(nullptr)
, mContext(nullptr)
, mSocket(aInstance)
, mTransportContext(nullptr)
, mMessageSubType(Message::kSubTypeNone)
, mMessageDefaultSubType(Message::kSubTypeNone)
{
Expand Down Expand Up @@ -150,7 +148,6 @@ Error Dtls::Open(ReceiveHandler aReceiveHandler, ConnectedHandler aConnectedHand

mConnectedCallback.Set(aConnectedHandler, aContext);
mReceiveCallback.Set(aReceiveHandler, aContext);
mContext = aContext;
mState = kStateOpen;

exit:
Expand Down Expand Up @@ -245,7 +242,6 @@ Error Dtls::Bind(TransportCallback aCallback, void *aContext)
VerifyOrExit(!mTransportCallback.IsSet(), error = kErrorAlready);

mTransportCallback.Set(aCallback, aContext);
mTransportContext = aContext;

exit:
return error;
Expand Down Expand Up @@ -458,7 +454,6 @@ void Dtls::Close(void)
Disconnect();

mState = kStateClosed;
mTransportContext = nullptr;
mTimerSet = false;
mTransportCallback.Clear();

Expand Down
10 changes: 10 additions & 0 deletions src/core/meshcop/tcat_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,16 @@ Error TcatAgent::HandleStartThreadInterface(void)
return error;
}

#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_WARN)
void TcatAgent::LogError(const char *aActionText, Error aError)
{
if (aError != kErrorNone)
{
LogWarn("Failed to %s: %s", aActionText, ErrorToString(aError));
}
}
#endif

} // namespace MeshCoP
} // namespace ot

Expand Down
6 changes: 6 additions & 0 deletions src/core/meshcop/tcat_agent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,12 @@ class TcatAgent : public InstanceLocator, private NonCopyable
Error HandleSetActiveOperationalDataset(const Message &aIncommingMessage, uint32_t aOffset, uint32_t aLength);
Error HandleStartThreadInterface(void);

#if OT_SHOULD_LOG_AT(OT_LOG_LEVEL_WARN)
void LogError(const char *aActionText, Error aError);
#else
void LogError(const char *, Error) {}
#endif

static constexpr uint16_t kJoinerUdpPort = OPENTHREAD_CONFIG_JOINER_UDP_PORT;

JoinerPskd mJoinerPskd;
Expand Down

0 comments on commit b5982b1

Please sign in to comment.