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

Function doClose

modules/io/socket/lwip/tcp.c:270–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270void doClose(xsMachine *the, xsSlot *instance)
271{
272 TCP tcp = xsmcGetHostData(*instance);
273 if (tcp && xsmcGetHostDataValidate(*instance, (void *)&xsTCPHooks)) {
274 tcp->ready = false;
275
276 removeTCPCallbacks(tcp);
277 tcp->triggerable = 0;
278
279 xsmcSetHostData(*instance, NULL);
280 xsForget(tcp->obj);
281 xsmcSetHostDestructor(*instance, NULL);
282#if TCP_ATOMICS
283 modAtomicsExchange_n(&tcp->triggered, 0);
284#else
285 builtinCriticalSectionBegin();
286 tcp->triggered = 0;
287 builtinCriticalSectionEnd();
288#endif
289 tcpRelease(tcp);
290 }
291}
292
293void xs_tcp_close(xsMachine *the)
294{

Callers 2

xs_tcp_constructorFunction · 0.70
xs_tcp_closeFunction · 0.70

Calls 2

removeTCPCallbacksFunction · 0.70
tcpReleaseFunction · 0.70

Tested by

no test coverage detected