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

Function fxDisconnect

xs/platforms/esp/xsPlatform.c:494–527  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

492}
493
494void fxDisconnect(txMachine* the)
495{
496 xmodLog(" fxDisconnect - ENTER");
497 if (the->connection) {
498
499 if (kSerialConnection != the->connection) {
500/* uint8_t i, closeMsg[2];
501 for (i = 0; i < kDebugReaderCount; i++) {
502 if (the->readers[i])
503 pbuf_free(the->readers[i]);
504 the->readers[i] = NULL;
505 }
506 closeMsg[0] = 0x88;
507 closeMsg[1] = 0;
508 tcp_write_safe(the->connection, closeMsg, sizeof(closeMsg), TCP_WRITE_FLAG_COPY);
509 tcp_output_safe(the->connection);
510
511 the->readerOffset = 0;
512 tcp_recv(the->connection, NULL);
513 tcp_err(the->connection, NULL);
514 if (18 != the->wsState)
515 tcp_close_safe((struct tcp_pcb *)the->connection);
516*/ }
517 else {
518 mxDebugMutexTake();
519 fx_putpi(the, '-', true);
520 the->debugConnectionVerified = 0;
521 mxDebugMutexGive();
522 //@@ clear debug fragments?
523 }
524 the->connection = NULL;
525 }
526 xmodLog(" fxDisconnect - EXIT");
527}
528
529txBoolean fxIsConnected(txMachine* the)
530{

Callers 2

fxReceiveFunction · 0.70
doRemoteCommandFunction · 0.70

Calls 1

fx_putpiFunction · 0.70

Tested by

no test coverage detected