MCPcopy Create free account
hub / github.com/3rdparty/libprocess / send

Function send

src/http.cpp:1536–1569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1534namespace internal {
1535
1536Future<Nothing> send(network::Socket socket, Encoder* encoder)
1537{
1538 size_t* size = new size_t(0);
1539 return loop(
1540 None(),
1541 [=]() {
1542 switch (encoder->kind()) {
1543 case Encoder::DATA: {
1544 const char* data = static_cast<DataEncoder*>(encoder)->next(size);
1545 return socket.send(data, *size);
1546 }
1547 case Encoder::FILE: {
1548 off_t offset = 0;
1549 int_fd fd = static_cast<FileEncoder*>(encoder)->next(&offset, size);
1550 return socket.sendfile(fd, offset, *size);
1551 }
1552 }
1553 UNREACHABLE();
1554 },
1555 [=](size_t length) -> ControlFlow<Nothing> {
1556 // Update the encoder with the amount sent.
1557 encoder->backup(*size - length);
1558
1559 // See if there is any more of the message to send.
1560 if (encoder->remaining() != 0) {
1561 return Continue();
1562 }
1563
1564 return Break();
1565 })
1566 .onAny([=]() {
1567 delete size;
1568 });
1569}
1570
1571
1572Future<Nothing> send(

Callers 6

sendfileFunction · 0.70
streamFunction · 0.70
serveFunction · 0.70
sendMethod · 0.50
replyMethod · 0.50
runMethod · 0.50

Calls 15

loopFunction · 0.85
InternalServerErrorClass · 0.85
ServiceUnavailableClass · 0.85
streamFunction · 0.85
recoverMethod · 0.80
isFailedMethod · 0.80
isDiscardedMethod · 0.80
sendfileFunction · 0.70
ContinueClass · 0.50
BreakFunction · 0.50
awaitFunction · 0.50
kindMethod · 0.45

Tested by

no test coverage detected