|
48 | 48 |
|
49 | 49 | #include "InetFaultInjection.h"
|
50 | 50 |
|
| 51 | +#include <platform/LockTracker.h> |
| 52 | + |
51 | 53 | #include <system/SystemTimer.h>
|
52 | 54 |
|
53 | 55 | #include <support/CodeUtils.h>
|
@@ -535,6 +537,8 @@ INET_ERROR InetLayer::GetLinkLocalAddr(InterfaceId link, IPAddress * llAddr)
|
535 | 537 | */
|
536 | 538 | INET_ERROR InetLayer::NewRawEndPoint(IPVersion ipVer, IPProtocol ipProto, RawEndPoint ** retEndPoint)
|
537 | 539 | {
|
| 540 | + assertChipStackLockedByCurrentThread(); |
| 541 | + |
538 | 542 | *retEndPoint = nullptr;
|
539 | 543 |
|
540 | 544 | VerifyOrReturnError(State == kState_Initialized, INET_ERROR_INCORRECT_STATE);
|
@@ -573,6 +577,8 @@ INET_ERROR InetLayer::NewRawEndPoint(IPVersion ipVer, IPProtocol ipProto, RawEnd
|
573 | 577 | */
|
574 | 578 | INET_ERROR InetLayer::NewTCPEndPoint(TCPEndPoint ** retEndPoint)
|
575 | 579 | {
|
| 580 | + assertChipStackLockedByCurrentThread(); |
| 581 | + |
576 | 582 | *retEndPoint = nullptr;
|
577 | 583 |
|
578 | 584 | VerifyOrReturnError(State == kState_Initialized, INET_ERROR_INCORRECT_STATE);
|
@@ -611,6 +617,8 @@ INET_ERROR InetLayer::NewTCPEndPoint(TCPEndPoint ** retEndPoint)
|
611 | 617 | */
|
612 | 618 | INET_ERROR InetLayer::NewUDPEndPoint(UDPEndPoint ** retEndPoint)
|
613 | 619 | {
|
| 620 | + assertChipStackLockedByCurrentThread(); |
| 621 | + |
614 | 622 | *retEndPoint = nullptr;
|
615 | 623 |
|
616 | 624 | VerifyOrReturnError(State == kState_Initialized, INET_ERROR_INCORRECT_STATE);
|
@@ -777,6 +785,8 @@ INET_ERROR InetLayer::ResolveHostAddress(const char * hostName, uint16_t hostNam
|
777 | 785 | INET_ERROR InetLayer::ResolveHostAddress(const char * hostName, uint16_t hostNameLen, uint8_t options, uint8_t maxAddrs,
|
778 | 786 | IPAddress * addrArray, DNSResolveCompleteFunct onComplete, void * appState)
|
779 | 787 | {
|
| 788 | + assertChipStackLockedByCurrentThread(); |
| 789 | + |
780 | 790 | INET_ERROR err = INET_NO_ERROR;
|
781 | 791 | DNSResolver * resolver = nullptr;
|
782 | 792 |
|
@@ -867,6 +877,8 @@ INET_ERROR InetLayer::ResolveHostAddress(const char * hostName, uint16_t hostNam
|
867 | 877 | */
|
868 | 878 | void InetLayer::CancelResolveHostAddress(DNSResolveCompleteFunct onComplete, void * appState)
|
869 | 879 | {
|
| 880 | + assertChipStackLockedByCurrentThread(); |
| 881 | + |
870 | 882 | if (State != kState_Initialized)
|
871 | 883 | return;
|
872 | 884 |
|
@@ -1016,6 +1028,8 @@ void InetLayer::HandleTCPInactivityTimer(chip::System::Layer * aSystemLayer, voi
|
1016 | 1028 | chip::System::Error InetLayer::HandleInetLayerEvent(chip::System::Object & aTarget, chip::System::EventType aEventType,
|
1017 | 1029 | uintptr_t aArgument)
|
1018 | 1030 | {
|
| 1031 | + assertChipStackLockedByCurrentThread(); |
| 1032 | + |
1019 | 1033 | VerifyOrReturnError(INET_IsInetEvent(aEventType), CHIP_SYSTEM_ERROR_UNEXPECTED_EVENT);
|
1020 | 1034 |
|
1021 | 1035 | // Dispatch the event according to its type.
|
@@ -1100,6 +1114,8 @@ chip::System::Error InetLayer::HandleInetLayerEvent(chip::System::Object & aTarg
|
1100 | 1114 | */
|
1101 | 1115 | void InetLayer::PrepareSelect(int & nfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds, struct timeval & sleepTimeTV)
|
1102 | 1116 | {
|
| 1117 | + assertChipStackLockedByCurrentThread(); |
| 1118 | + |
1103 | 1119 | if (State != kState_Initialized)
|
1104 | 1120 | return;
|
1105 | 1121 |
|
@@ -1160,6 +1176,8 @@ void InetLayer::PrepareSelect(int & nfds, fd_set * readfds, fd_set * writefds, f
|
1160 | 1176 | */
|
1161 | 1177 | void InetLayer::HandleSelectResult(int selectRes, fd_set * readfds, fd_set * writefds, fd_set * exceptfds)
|
1162 | 1178 | {
|
| 1179 | + assertChipStackLockedByCurrentThread(); |
| 1180 | + |
1163 | 1181 | if (State != kState_Initialized)
|
1164 | 1182 | return;
|
1165 | 1183 |
|
|
0 commit comments