More imports
This commit is contained in:
33
connection.h
Normal file
33
connection.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <sys/uio.h>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "request.h"
|
||||
#include "stream_buffer.h"
|
||||
|
||||
namespace firecgi {
|
||||
|
||||
class Connection {
|
||||
public:
|
||||
Connection(int sock, const sockaddr_in6& client_addr, const std::function<void(std::unique_ptr<Request>)>& callback, const std::unordered_set<std::string_view>& headers);
|
||||
~Connection();
|
||||
|
||||
[[nodiscard]] int Read();
|
||||
[[nodiscard]] bool Write(const std::vector<iovec>& vecs);
|
||||
|
||||
private:
|
||||
const int sock_;
|
||||
const std::function<void(std::unique_ptr<Request>)>& callback_;
|
||||
const std::unordered_set<std::string_view>& headers_;
|
||||
|
||||
uint64_t requests_ = 0;
|
||||
|
||||
StreamBuffer buf_;
|
||||
|
||||
std::unique_ptr<Request> request_;
|
||||
};
|
||||
|
||||
} // namespace firecgi
|
||||
Reference in New Issue
Block a user