| 603 | } |
| 604 | |
| 605 | void 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 |
nothing calls this directly
no test coverage detected