Support persistent connection for server.
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "boost/asio/ip/tcp.hpp"
|
||||
|
||||
@@ -23,25 +22,6 @@ std::string EndpointToString(const TcpEndpoint& endpoint);
|
||||
// See: https://tools.ietf.org/html/rfc7231#section-7.1.1.2
|
||||
std::string GetHttpDateTimestamp();
|
||||
|
||||
// Resize a buffer in ctor and restore its original size in dtor.
|
||||
struct BufferResizer {
|
||||
BufferResizer(std::vector<char>* buffer, std::size_t new_size)
|
||||
: buffer_(buffer), old_size_(buffer->size()) {
|
||||
if (new_size != 0 && new_size != old_size_) {
|
||||
buffer_->resize(new_size);
|
||||
}
|
||||
}
|
||||
|
||||
~BufferResizer() {
|
||||
if (buffer_->size() != old_size_) {
|
||||
buffer_->resize(old_size_);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<char>* buffer_;
|
||||
std::size_t old_size_;
|
||||
};
|
||||
|
||||
} // namespace webcc
|
||||
|
||||
#endif // WEBCC_UTILITY_H_
|
||||
|
||||
Reference in New Issue
Block a user