@@ -1082,7 +1082,11 @@ void IPEndPointBasis::HandlePendingIO(uint16_t aPort)
1082
1082
{
1083
1083
INET_ERROR lStatus = INET_NO_ERROR;
1084
1084
IPPacketInfo lPacketInfo;
1085
+ #if CHIP_SYSTEM_CONFIG_USE_DISPATCH
1086
+ __block System::PacketBufferHandle lBuffer;
1087
+ #else
1085
1088
System::PacketBufferHandle lBuffer;
1089
+ #endif // CHIP_SYSTEM_CONFIG_USE_DISPATCH
1086
1090
1087
1091
lPacketInfo.Clear ();
1088
1092
lPacketInfo.DestPort = aPort;
@@ -1189,12 +1193,35 @@ void IPEndPointBasis::HandlePendingIO(uint16_t aPort)
1189
1193
if (lStatus == INET_NO_ERROR)
1190
1194
{
1191
1195
lBuffer.RightSize ();
1192
- OnMessageReceived (this , std::move (lBuffer), &lPacketInfo);
1196
+
1197
+ #if CHIP_SYSTEM_CONFIG_USE_DISPATCH
1198
+ dispatch_queue_t dispatchQueue = SystemLayer ().GetDispatchQueue ();
1199
+ if (dispatchQueue != nullptr )
1200
+ {
1201
+ dispatch_sync (dispatchQueue, ^{
1202
+ OnMessageReceived (this , std::move (lBuffer), &lPacketInfo);
1203
+ });
1204
+ }
1205
+ else
1206
+ #endif // CHIP_SYSTEM_CONFIG_USE_DISPATCH
1207
+ OnMessageReceived (this , std::move (lBuffer), &lPacketInfo);
1193
1208
}
1194
1209
else
1195
1210
{
1196
1211
if (OnReceiveError != nullptr && lStatus != chip::System::MapErrorPOSIX (EAGAIN))
1197
- OnReceiveError (this , lStatus, nullptr );
1212
+ {
1213
+ #if CHIP_SYSTEM_CONFIG_USE_DISPATCH
1214
+ dispatch_queue_t dispatchQueue = SystemLayer ().GetDispatchQueue ();
1215
+ if (dispatchQueue != nullptr )
1216
+ {
1217
+ dispatch_sync (dispatchQueue, ^{
1218
+ OnReceiveError (this , lStatus, nullptr );
1219
+ });
1220
+ }
1221
+ else
1222
+ #endif // CHIP_SYSTEM_CONFIG_USE_DISPATCH
1223
+ OnReceiveError (this , lStatus, nullptr );
1224
+ }
1198
1225
}
1199
1226
}
1200
1227
#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS
0 commit comments