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

Function tcpTrySend

modules/io/socket/zephyr/tcp.c:605–629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

603}
604
605void tcpTrySend(modTimer timer, void *refcon, int refconSize)
606{
607 TCP tcp = *(TCP *)refcon;
608 int result = net_context_send(tcp->context, tcp->pendingBuffer, tcp->pendingBytes, C_NULL, K_NO_WAIT, C_NULL);
609 if (result <= 0) {
610 if (-EAGAIN == result)
611 result = 0;
612 if (result)
613 tcpTrigger(tcp, kTCPError);
614 return;
615 }
616
617 tcp->pendingBuffer += result;
618 tcp->pendingBytes -= result;
619 if (tcp->pendingBytes)
620 return;
621
622 c_free(tcp->pending);
623 tcp->pending = tcp->pendingBuffer = C_NULL;
624
625 modTimerRemove(tcp->pendingTimer);
626 tcp->pendingTimer = C_NULL;
627
628 tcpTrigger(tcp, kTCPWritable);
629}
630
631/*
632 Listener

Callers

nothing calls this directly

Calls 2

tcpTriggerFunction · 0.70
modTimerRemoveFunction · 0.50

Tested by

no test coverage detected