MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / read

Method read

extensions/http-curl/client/HTTPStream.cpp:84–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84int HttpStream::read(uint8_t *buf, int buflen) {
85 gsl_Expects(buflen >= 0);
86 if (buflen == 0) {
87 return 0;
88 }
89 if (!IsNullOrEmpty(buf)) {
90 if (!started_) {
91 std::lock_guard<std::mutex> lock(mutex_);
92 if (!started_) {
93 read_callback_.ptr = &http_read_callback_;
94 read_callback_.pos = 0;
95 http_client_->setReadCallback(&read_callback_);
96 http_client_future_ = std::async(std::launch::async, submit_read_client, http_client_, &http_read_callback_);
97 started_ = true;
98 }
99 }
100 return gsl::narrow<int>(http_read_callback_.readFully((char*) buf, buflen));
101
102 } else {
103 return -1;
104 }
105}
106
107} /* namespace io */
108} /* namespace minifi */

Callers 2

processMethod · 0.45
onTriggerMethod · 0.45

Calls 3

IsNullOrEmptyFunction · 0.85
setReadCallbackMethod · 0.80
readFullyMethod · 0.80

Tested by

no test coverage detected