Add WriteMany()
This commit is contained in:
11
request.h
11
request.h
@@ -30,9 +30,13 @@ class Request {
|
||||
[[nodiscard]] bool Flush();
|
||||
bool End();
|
||||
|
||||
template<typename...Args>
|
||||
void WriteMany(const std::string_view& first, Args... more);
|
||||
|
||||
private:
|
||||
Header OutputHeader();
|
||||
iovec OutputVec();
|
||||
void WriteBodyLocked(const std::string_view& body);
|
||||
|
||||
Connection *conn_;
|
||||
uint16_t request_id_ = 0;
|
||||
@@ -45,4 +49,11 @@ class Request {
|
||||
std::mutex output_mu_;
|
||||
};
|
||||
|
||||
template<typename...Args>
|
||||
void Request::WriteMany(const std::string_view& first, Args... more) {
|
||||
std::lock_guard<std::mutex> l(output_mu_);
|
||||
WriteBodyLocked(first);
|
||||
WriteMany(std::forward(more)...);
|
||||
}
|
||||
|
||||
} // namespace firecgi
|
||||
|
||||
Reference in New Issue
Block a user