MCPcopy Create free account
hub / github.com/apache/mesos / stream

Function stream

3rdparty/libprocess/src/http.cpp:1769–1807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1767
1768
1769Future<Nothing> stream(
1770 const network::Socket& socket,
1771 http::Pipe::Reader reader)
1772{
1773 return loop(
1774 None(),
1775 [=]() mutable {
1776 return reader.read();
1777 },
1778 [=](const string& data) mutable {
1779 bool finished = false;
1780
1781 ostringstream out;
1782
1783 if (data.empty()) {
1784 // Finished reading.
1785 out << "0\r\n" << "\r\n";
1786 finished = true;
1787 } else {
1788 out << std::hex << data.size() << "\r\n";
1789 out << data;
1790 out << "\r\n";
1791 }
1792
1793 Encoder* encoder = new DataEncoder(out.str());
1794
1795 return send(socket, encoder)
1796 .onAny([=]() {
1797 delete encoder;
1798 })
1799 .then([=]() mutable -> ControlFlow<Nothing> {
1800 if (!finished) {
1801 return Continue();
1802 }
1803
1804 return Break();
1805 });
1806 });
1807}
1808
1809
1810Future<Nothing> stream(

Callers 2

__ExitMethod · 0.85
sendFunction · 0.85

Calls 14

loopFunction · 0.85
NoneClass · 0.85
InternalServerErrorClass · 0.85
sendFunction · 0.70
ContinueClass · 0.50
BreakFunction · 0.50
readMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
thenMethod · 0.45
clearMethod · 0.45
isNoneMethod · 0.45

Tested by

no test coverage detected