MCPcopy Create free account
hub / github.com/catboost/catboost / SendAckForConnection

Method SendAckForConnection

library/cpp/netliba/v12/udp_host.cpp:1584–1610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1582 fprintf(stderr, "\n");
1583 }
1584 void TUdpHost::SendAckForConnection(TConnection* connection, const float& deltaT) {
1585 for (TRecvTransfers::TIdIterator i = connection->GetRecvQueue().Begin(); i != connection->GetRecvQueue().End(); ) {
1586 TTransfer transfer(connection, *i);
1587 TUdpInTransfer& xfer = *connection->GetRecvQueue().Get(*i);
1588 xfer.TimeSinceLastRecv += deltaT;
1589 if (xfer.TimeSinceLastRecv > UDP_MAX_INPUT_DATA_WAIT) {
1590 fprintf(stderr, "recv %" PRIu64 " failed by timeout\n", (ui64)*i);
1591 ++i;
1592 connection->FailedRecvTransfer(transfer.Id);
1593 continue;
1594 }
1595#ifndef NDEBUG
1596 bool dummy;
1597 Y_ASSERT(!connection->IsRecvCompleted(transfer.Id, &dummy, &dummy)); // state "Complete & incomplete" is incorrect
1598#endif
1599 if (!xfer.NewPacketsToAck.empty()) {
1600 std::pair<char*, ui8> packetBuffer = GetPacketBuffer(UDP_PACKET_BUF_SIZE, connection, transfer.Id);
1601 if (!packetBuffer.first) { // buffer overflow, stop trying to send ACK, continue just checking keep alives.
1602 fprintf(stderr, "can`t get packetBuffer to send ACK, err: %i\n", packetBuffer.second);
1603 ++i;
1604 continue;
1605 }
1606 AddAcksToPacketQueue(S, packetBuffer.first, UDP_PACKET_BUF_SIZE, connection, transfer.Id, &xfer);
1607 }
1608 ++i;
1609 }
1610 }
1611
1612 void TUdpHost::CheckConnectionsAndSendAcks() {
1613 NHPTimer::STime start;

Callers

nothing calls this directly

Calls 7

AddAcksToPacketQueueFunction · 0.85
FailedRecvTransferMethod · 0.80
IsRecvCompletedMethod · 0.80
BeginMethod · 0.45
EndMethod · 0.45
GetMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected