| 268 | } |
| 269 | |
| 270 | void 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 | |
| 293 | void xs_tcp_close(xsMachine *the) |
| 294 | { |
no test coverage detected