MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / socketClearPending

Function socketClearPending

modules/network/socket/lwip/modSocket.c:1304–1352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1302}
1303
1304void socketClearPending(void *the, void *refcon, uint8_t *message, uint16_t messageLength)
1305{
1306 xsSocket xss = refcon;
1307 uint8_t pending;
1308
1309 if (xss->suspended)
1310 return;
1311
1312 modCriticalSectionBegin();
1313
1314 pending = xss->pending;
1315 xss->pending &= kPendingClose; // don't clear close flag
1316
1317 modCriticalSectionEnd();
1318
1319 if (!pending) {
1320 modLog("socketClearPending called - NOTHING PENDING?");
1321 goto done; // return or done...
1322 }
1323
1324 if ((pending & kPendingConnect) && !(xss->pending & kPendingClose))
1325 socketMsgConnect(xss);
1326
1327 if ((pending & kPendingReceive) && !(xss->pending & kPendingClose))
1328 socketMsgDataReceived(xss);
1329
1330 if ((pending & kPendingSent) && !(xss->pending & kPendingClose))
1331 socketMsgDataSent(xss);
1332
1333 if ((pending & kPendingOutput) && !(xss->pending & kPendingClose) && xss->skt)
1334 tcp_output_safe(xss->skt);
1335
1336 if ((pending & kPendingDisconnect) && !(xss->pending & kPendingClose))
1337 socketMsgDisconnect(xss);
1338
1339 if ((pending & kPendingError) && !(xss->pending & kPendingClose))
1340 socketMsgError(xss);
1341
1342 if ((pending & kPendingAcceptListener) && !(xss->pending & kPendingClose))
1343 listenerMsgNew((xsListener)xss);
1344
1345 if (pending & kPendingClose) {
1346 if (socketDownUseCount(xss->the, xss))
1347 return;
1348 }
1349
1350done:
1351 socketDownUseCount(xss->the, xss);
1352}
1353
1354void *modSocketGetLWIP(xsMachine *the, xsSlot *slot)
1355{

Callers

nothing calls this directly

Calls 8

socketMsgConnectFunction · 0.85
socketMsgDataReceivedFunction · 0.85
socketMsgDataSentFunction · 0.85
tcp_output_safeFunction · 0.85
socketMsgDisconnectFunction · 0.85
listenerMsgNewFunction · 0.85
socketMsgErrorFunction · 0.70
socketDownUseCountFunction · 0.70

Tested by

no test coverage detected