mirror of
https://github.com/espressif/openthread.git
synced 2026-08-01 00:27:47 +00:00
[ip6] update HandlePayload() (avoid msg clone if not needed) (#8023)
This commit adds a smaller enhancement in `Ip6::HandlePayload()`. If support for TCP `OPENTHREAD_CONFIG_TCP_ENABLE` is not enabled, we exit early from this method before potentially creating a clone of the message (to free later).
This commit is contained in:
+12
-1
@@ -950,7 +950,18 @@ Error Ip6::HandlePayload(Header & aIp6Header,
|
||||
Error error = kErrorNone;
|
||||
Message *message = (aMessageOwnership == Message::kTakeCustody) ? &aMessage : nullptr;
|
||||
|
||||
VerifyOrExit(aIpProto == kProtoTcp || aIpProto == kProtoUdp || aIpProto == kProtoIcmp6);
|
||||
switch (aIpProto)
|
||||
{
|
||||
case kProtoUdp:
|
||||
case kProtoIcmp6:
|
||||
break;
|
||||
#if OPENTHREAD_CONFIG_TCP_ENABLE
|
||||
case kProtoTcp:
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ExitNow();
|
||||
}
|
||||
|
||||
if (aMessageOwnership == Message::kCopyToUse)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user