MCPcopy Create free account
hub / github.com/apple/foundationdb / sent

Method sent

flow/Net2Packet.cpp:142–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142void UnsentPacketQueue::sent(int bytes) {
143 while (bytes) {
144 ASSERT(unsent_first);
145 PacketBuffer* b = unsent_first;
146
147 if (b->bytes_sent + bytes <= b->bytes_written &&
148 (b->bytes_sent + bytes != b->bytes_written || (!b->next && b->bytes_unwritten()))) {
149 b->bytes_sent += bytes;
150 ASSERT(b->bytes_sent <= b->size());
151 break;
152 }
153
154 // We've sent an entire buffer
155 bytes -= b->bytes_written - b->bytes_sent;
156 b->bytes_sent = b->bytes_written;
157 ASSERT(b->bytes_written <= b->size());
158 double queue_time = now() - b->enqueue_time;
159 sendQueueLatencyHistogram->sampleSeconds(queue_time);
160 unsent_first = b->nextPacketBuffer();
161 if (!unsent_first)
162 unsent_last = nullptr;
163 b->delref();
164 }
165}
166
167void UnsentPacketQueue::discardAll() {
168 while (unsent_first) {

Callers 3

writeMsgFunction · 0.80
Response>> doRequestMethod · 0.80

Calls 6

nowFunction · 0.85
bytes_unwrittenMethod · 0.80
sampleSecondsMethod · 0.80
nextPacketBufferMethod · 0.80
sizeMethod · 0.45
delrefMethod · 0.45

Tested by 1

writeMsgFunction · 0.64