summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-04 18:35:54 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-04 18:35:54 +0000
commitecef1ff71284719fa8e1a1e23372175ba828a4be (patch)
tree463491d785bbfd075c2a805593691410f1fdd188 /net
parent549e89a687830b2a6782a9fabdd1da8845532920 (diff)
downloadchromium_src-ecef1ff71284719fa8e1a1e23372175ba828a4be.zip
chromium_src-ecef1ff71284719fa8e1a1e23372175ba828a4be.tar.gz
chromium_src-ecef1ff71284719fa8e1a1e23372175ba828a4be.tar.bz2
Cleanup the net/tools/ directory so there are no warnings from our clang plugin.
(I've separated this chunk out since mbelshe said he was working here and I don't want to accidentally clobber his work. This is the last patch before Nico can turn the inlining plugin on for all targets.) BUG=none TEST=compiles Review URL: http://codereview.chromium.org/6368037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73820 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/net.gyp4
-rw-r--r--net/tools/fetch/http_listen_socket.cc4
-rw-r--r--net/tools/fetch/http_listen_socket.h2
-rw-r--r--net/tools/fetch/http_server_request_info.cc11
-rw-r--r--net/tools/fetch/http_server_request_info.h5
-rw-r--r--net/tools/fetch/http_server_response_info.cc11
-rw-r--r--net/tools/fetch/http_server_response_info.h7
-rw-r--r--net/tools/flip_server/acceptor_thread.h2
-rw-r--r--net/tools/flip_server/balsa_frame.cc23
-rw-r--r--net/tools/flip_server/balsa_frame.h23
-rw-r--r--net/tools/flip_server/balsa_headers.cc169
-rw-r--r--net/tools/flip_server/balsa_headers.h165
-rw-r--r--net/tools/flip_server/epoll_server.cc18
-rw-r--r--net/tools/flip_server/epoll_server.h16
-rw-r--r--net/tools/flip_server/flip_config.cc139
-rw-r--r--net/tools/flip_server/flip_config.h150
-rw-r--r--net/tools/flip_server/http_interface.cc36
-rw-r--r--net/tools/flip_server/http_interface.h74
-rw-r--r--net/tools/flip_server/mem_cache.cc52
-rw-r--r--net/tools/flip_server/mem_cache.h52
-rw-r--r--net/tools/flip_server/output_ordering.cc41
-rw-r--r--net/tools/flip_server/output_ordering.h37
-rw-r--r--net/tools/flip_server/ring_buffer.cc14
-rw-r--r--net/tools/flip_server/ring_buffer.h6
-rw-r--r--net/tools/flip_server/sm_connection.cc13
-rw-r--r--net/tools/flip_server/sm_connection.h12
-rw-r--r--net/tools/flip_server/spdy_interface.h64
-rw-r--r--net/tools/flip_server/streamer_interface.cc25
-rw-r--r--net/tools/flip_server/streamer_interface.h69
29 files changed, 754 insertions, 490 deletions
diff --git a/net/net.gyp b/net/net.gyp
index bda8cb4..d9aca9d 100644
--- a/net/net.gyp
+++ b/net/net.gyp
@@ -1285,7 +1285,9 @@
'tools/fetch/http_listen_socket.h',
'tools/fetch/http_server.cc',
'tools/fetch/http_server.h',
+ 'tools/fetch/http_server_request_info.cc',
'tools/fetch/http_server_request_info.h',
+ 'tools/fetch/http_server_response_info.cc',
'tools/fetch/http_server_response_info.h',
'tools/fetch/http_session.cc',
'tools/fetch/http_session.h',
@@ -1365,6 +1367,8 @@
'tools/flip_server/create_listener.h',
'tools/flip_server/epoll_server.cc',
'tools/flip_server/epoll_server.h',
+ 'tools/flip_server/flip_config.cc',
+ 'tools/flip_server/flip_config.h',
'tools/flip_server/flip_in_mem_edsm_server.cc',
'tools/flip_server/http_interface.cc',
'tools/flip_server/http_interface.h',
diff --git a/net/tools/fetch/http_listen_socket.cc b/net/tools/fetch/http_listen_socket.cc
index 0db714f..78d924d 100644
--- a/net/tools/fetch/http_listen_socket.cc
+++ b/net/tools/fetch/http_listen_socket.cc
@@ -24,6 +24,10 @@ HttpListenSocket::HttpListenSocket(SOCKET s,
HttpListenSocket::~HttpListenSocket() {
}
+void HttpListenSocket::Listen() {
+ ListenSocket::Listen();
+}
+
void HttpListenSocket::Accept() {
SOCKET conn = ListenSocket::Accept(socket_);
DCHECK_NE(conn, ListenSocket::kInvalidSocket);
diff --git a/net/tools/fetch/http_listen_socket.h b/net/tools/fetch/http_listen_socket.h
index 781ac32..82f5312 100644
--- a/net/tools/fetch/http_listen_socket.h
+++ b/net/tools/fetch/http_listen_socket.h
@@ -28,7 +28,7 @@ class HttpListenSocket : public ListenSocket,
static HttpListenSocket* Listen(const std::string& ip, int port,
HttpListenSocket::Delegate* delegate);
- void Listen() { ListenSocket::Listen(); }
+ virtual void Listen();
virtual void Accept();
// Send a server response.
diff --git a/net/tools/fetch/http_server_request_info.cc b/net/tools/fetch/http_server_request_info.cc
new file mode 100644
index 0000000..52b6860
--- /dev/null
+++ b/net/tools/fetch/http_server_request_info.cc
@@ -0,0 +1,11 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/tools/fetch/http_server_request_info.h"
+
+HttpServerRequestInfo::HttpServerRequestInfo()
+ : net::HttpRequestInfo() {
+}
+
+HttpServerRequestInfo::~HttpServerRequestInfo() {}
diff --git a/net/tools/fetch/http_server_request_info.h b/net/tools/fetch/http_server_request_info.h
index 2b7cfb5..9a94dcd 100644
--- a/net/tools/fetch/http_server_request_info.h
+++ b/net/tools/fetch/http_server_request_info.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -17,7 +17,8 @@
// does).
class HttpServerRequestInfo : public net::HttpRequestInfo {
public:
- HttpServerRequestInfo() : net::HttpRequestInfo() {}
+ HttpServerRequestInfo();
+ virtual ~HttpServerRequestInfo();
// A map of the names -> values for HTTP headers.
std::map<std::string, std::string> headers;
diff --git a/net/tools/fetch/http_server_response_info.cc b/net/tools/fetch/http_server_response_info.cc
new file mode 100644
index 0000000..d9ca02a
--- /dev/null
+++ b/net/tools/fetch/http_server_response_info.cc
@@ -0,0 +1,11 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/tools/fetch/http_server_response_info.h"
+
+HttpServerResponseInfo::HttpServerResponseInfo()
+ : status(200), content_length(0), connection_close(false) {
+}
+
+HttpServerResponseInfo::~HttpServerResponseInfo() {}
diff --git a/net/tools/fetch/http_server_response_info.h b/net/tools/fetch/http_server_response_info.h
index 7a8bb1f..d0ef863 100644
--- a/net/tools/fetch/http_server_response_info.h
+++ b/net/tools/fetch/http_server_response_info.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,9 +12,8 @@
// Meta information about a server response.
class HttpServerResponseInfo {
public:
- HttpServerResponseInfo()
- : status(200), content_length(0), connection_close(false) {
- }
+ HttpServerResponseInfo();
+ ~HttpServerResponseInfo();
// The response protocol.
std::string protocol;
diff --git a/net/tools/flip_server/acceptor_thread.h b/net/tools/flip_server/acceptor_thread.h
index 8e79ed7..8a30532 100644
--- a/net/tools/flip_server/acceptor_thread.h
+++ b/net/tools/flip_server/acceptor_thread.h
@@ -72,7 +72,7 @@ class SMAcceptorThread : public base::SimpleThread,
// idle longer than the configured timeout.
void HandleConnectionIdleTimeout();
- void Run();
+ virtual void Run();
private:
EpollServer epoll_server_;
diff --git a/net/tools/flip_server/balsa_frame.cc b/net/tools/flip_server/balsa_frame.cc
index 9b8173e..cda5527 100644
--- a/net/tools/flip_server/balsa_frame.cc
+++ b/net/tools/flip_server/balsa_frame.cc
@@ -33,6 +33,29 @@ static const size_t kContentLengthSize = sizeof(kContentLength) - 1;
static const char kTransferEncoding[] = "transfer-encoding";
static const size_t kTransferEncodingSize = sizeof(kTransferEncoding) - 1;
+BalsaFrame::BalsaFrame()
+ : last_char_was_slash_r_(false),
+ saw_non_newline_char_(false),
+ start_was_space_(true),
+ chunk_length_character_extracted_(false),
+ is_request_(true),
+ request_was_head_(false),
+ max_header_length_(16 * 1024),
+ max_request_uri_length_(2048),
+ visitor_(&do_nothing_visitor_),
+ chunk_length_remaining_(0),
+ content_length_remaining_(0),
+ last_slash_n_loc_(NULL),
+ last_recorded_slash_n_loc_(NULL),
+ last_slash_n_idx_(0),
+ term_chars_(0),
+ parse_state_(BalsaFrameEnums::READING_HEADER_AND_FIRSTLINE),
+ last_error_(BalsaFrameEnums::NO_ERROR),
+ headers_(NULL) {
+}
+
+BalsaFrame::~BalsaFrame() {}
+
void BalsaFrame::Reset() {
last_char_was_slash_r_ = false;
saw_non_newline_char_ = false;
diff --git a/net/tools/flip_server/balsa_frame.h b/net/tools/flip_server/balsa_frame.h
index 6c0b1d0..74ff7bc 100644
--- a/net/tools/flip_server/balsa_frame.h
+++ b/net/tools/flip_server/balsa_frame.h
@@ -47,27 +47,8 @@ class BalsaFrame {
'\n';
static const uint32 kValidTerm2Mask = 0xFF << 8 |
0xFF;
- BalsaFrame() :
- last_char_was_slash_r_(false),
- saw_non_newline_char_(false),
- start_was_space_(true),
- chunk_length_character_extracted_(false),
- is_request_(true),
- request_was_head_(false),
- max_header_length_(16 * 1024),
- max_request_uri_length_(2048),
- visitor_(&do_nothing_visitor_),
- chunk_length_remaining_(0),
- content_length_remaining_(0),
- last_slash_n_loc_(NULL),
- last_recorded_slash_n_loc_(NULL),
- last_slash_n_idx_(0),
- term_chars_(0),
- parse_state_(BalsaFrameEnums::READING_HEADER_AND_FIRSTLINE),
- last_error_(BalsaFrameEnums::NO_ERROR),
- headers_(NULL) {}
-
- ~BalsaFrame() {}
+ BalsaFrame();
+ ~BalsaFrame();
// Reset reinitializes all the member variables of the framer and clears the
// attached header object (but doesn't change the pointer value headers_).
diff --git a/net/tools/flip_server/balsa_headers.cc b/net/tools/flip_server/balsa_headers.cc
index 74364a2..80a68fa 100644
--- a/net/tools/flip_server/balsa_headers.cc
+++ b/net/tools/flip_server/balsa_headers.cc
@@ -76,6 +76,175 @@ std::ostream& BalsaHeaders::iterator_base::operator<<(std::ostream& os) const {
return os;
}
+BalsaBuffer::~BalsaBuffer() {
+ CleanupBlocksStartingFrom(0);
+}
+
+// Returns the total amount of memory used by the buffer blocks.
+size_t BalsaBuffer::GetTotalBufferBlockSize() const {
+ size_t buffer_size = 0;
+ for (Blocks::const_iterator iter = blocks_.begin();
+ iter != blocks_.end();
+ ++iter) {
+ buffer_size += iter->buffer_size;
+ }
+ return buffer_size;
+}
+
+void BalsaBuffer::WriteToContiguousBuffer(const base::StringPiece& sp) {
+ if (sp.empty()) {
+ return;
+ }
+ CHECK(can_write_to_contiguous_buffer_);
+ DCHECK_GE(blocks_.size(), 1u);
+ if (blocks_[0].buffer == NULL && sp.size() <= blocksize_) {
+ blocks_[0] = AllocBlock();
+ memcpy(blocks_[0].start_of_unused_bytes(), sp.data(), sp.size());
+ } else if (blocks_[0].bytes_free < sp.size()) {
+ // the first block isn't big enough, resize it.
+ const size_t old_storage_size_used = blocks_[0].bytes_used();
+ const size_t new_storage_size = old_storage_size_used + sp.size();
+ char* new_storage = new char[new_storage_size];
+ char* old_storage = blocks_[0].buffer;
+ if (old_storage_size_used) {
+ memcpy(new_storage, old_storage, old_storage_size_used);
+ }
+ memcpy(new_storage + old_storage_size_used, sp.data(), sp.size());
+ blocks_[0].buffer = new_storage;
+ blocks_[0].bytes_free = sp.size();
+ blocks_[0].buffer_size = new_storage_size;
+ delete[] old_storage;
+ } else {
+ memcpy(blocks_[0].start_of_unused_bytes(), sp.data(), sp.size());
+ }
+ blocks_[0].bytes_free -= sp.size();
+}
+
+base::StringPiece BalsaBuffer::Write(const base::StringPiece& sp,
+ Blocks::size_type* block_buffer_idx) {
+ if (sp.empty()) {
+ return sp;
+ }
+ char* storage = Reserve(sp.size(), block_buffer_idx);
+ memcpy(storage, sp.data(), sp.size());
+ return base::StringPiece(storage, sp.size());
+}
+
+char* BalsaBuffer::Reserve(size_t size,
+ Blocks::size_type* block_buffer_idx) {
+ // There should always be a 'first_block', even if it
+ // contains nothing.
+ DCHECK_GE(blocks_.size(), 1u);
+ BufferBlock* block = NULL;
+ Blocks::size_type block_idx = can_write_to_contiguous_buffer_ ? 1 : 0;
+ for (; block_idx < blocks_.size(); ++block_idx) {
+ if (blocks_[block_idx].bytes_free >= size) {
+ block = &blocks_[block_idx];
+ break;
+ }
+ }
+ if (block == NULL) {
+ if (blocksize_ < size) {
+ blocks_.push_back(AllocCustomBlock(size));
+ } else {
+ blocks_.push_back(AllocBlock());
+ }
+ block = &blocks_.back();
+ }
+
+ char* storage = block->start_of_unused_bytes();
+ block->bytes_free -= size;
+ if (block_buffer_idx) {
+ *block_buffer_idx = block_idx;
+ }
+ return storage;
+}
+
+void BalsaBuffer::Clear() {
+ CHECK(!blocks_.empty());
+ if (blocksize_ == blocks_[0].buffer_size) {
+ CleanupBlocksStartingFrom(1);
+ blocks_[0].bytes_free = blocks_[0].buffer_size;
+ } else {
+ CleanupBlocksStartingFrom(0);
+ blocks_.push_back(AllocBlock());
+ }
+ DCHECK_GE(blocks_.size(), 1u);
+ can_write_to_contiguous_buffer_ = true;
+}
+
+void BalsaBuffer::Swap(BalsaBuffer* b) {
+ blocks_.swap(b->blocks_);
+ std::swap(can_write_to_contiguous_buffer_,
+ b->can_write_to_contiguous_buffer_);
+ std::swap(blocksize_, b->blocksize_);
+}
+
+void BalsaBuffer::CopyFrom(const BalsaBuffer& b) {
+ CleanupBlocksStartingFrom(0);
+ blocks_.resize(b.blocks_.size());
+ for (Blocks::size_type i = 0; i < blocks_.size(); ++i) {
+ blocks_[i] = CopyBlock(b.blocks_[i]);
+ }
+ blocksize_ = b.blocksize_;
+ can_write_to_contiguous_buffer_ = b.can_write_to_contiguous_buffer_;
+}
+
+BalsaBuffer::BalsaBuffer()
+ : blocksize_(kDefaultBlocksize), can_write_to_contiguous_buffer_(true) {
+ blocks_.push_back(AllocBlock());
+}
+
+BalsaBuffer::BalsaBuffer(size_t blocksize) :
+ blocksize_(blocksize), can_write_to_contiguous_buffer_(true) {
+ blocks_.push_back(AllocBlock());
+}
+
+BalsaBuffer::BufferBlock BalsaBuffer::AllocBlock() {
+ return AllocCustomBlock(blocksize_);
+}
+
+BalsaBuffer::BufferBlock BalsaBuffer::AllocCustomBlock(size_t blocksize) {
+ return BufferBlock(new char[blocksize], blocksize, blocksize);
+}
+
+BalsaBuffer::BufferBlock BalsaBuffer::CopyBlock(const BufferBlock& b) {
+ BufferBlock block = b;
+ if (b.buffer == NULL) {
+ return block;
+ }
+
+ block.buffer = new char[b.buffer_size];
+ memcpy(block.buffer, b.buffer, b.bytes_used());
+ return block;
+}
+
+void BalsaBuffer::CleanupBlocksStartingFrom(Blocks::size_type start_idx) {
+ for (Blocks::size_type i = start_idx; i < blocks_.size(); ++i) {
+ delete[] blocks_[i].buffer;
+ }
+ blocks_.resize(start_idx);
+}
+
+BalsaHeaders::BalsaHeaders()
+ : balsa_buffer_(4096),
+ content_length_(0),
+ content_length_status_(BalsaHeadersEnums::NO_CONTENT_LENGTH),
+ parsed_response_code_(0),
+ firstline_buffer_base_idx_(0),
+ whitespace_1_idx_(0),
+ non_whitespace_1_idx_(0),
+ whitespace_2_idx_(0),
+ non_whitespace_2_idx_(0),
+ whitespace_3_idx_(0),
+ non_whitespace_3_idx_(0),
+ whitespace_4_idx_(0),
+ end_of_firstline_idx_(0),
+ transfer_encoding_is_chunked_(false) {
+}
+
+BalsaHeaders::~BalsaHeaders() {}
+
void BalsaHeaders::Clear() {
balsa_buffer_.Clear();
transfer_encoding_is_chunked_ = false;
diff --git a/net/tools/flip_server/balsa_headers.h b/net/tools/flip_server/balsa_headers.h
index b51b7f4..f2b7612 100644
--- a/net/tools/flip_server/balsa_headers.h
+++ b/net/tools/flip_server/balsa_headers.h
@@ -96,20 +96,10 @@ class BalsaBuffer {
typedef std::vector<BufferBlock> Blocks;
- ~BalsaBuffer() {
- CleanupBlocksStartingFrom(0);
- }
+ ~BalsaBuffer();
// Returns the total amount of memory used by the buffer blocks.
- size_t GetTotalBufferBlockSize() const {
- size_t buffer_size = 0;
- for (Blocks::const_iterator iter = blocks_.begin();
- iter != blocks_.end();
- ++iter) {
- buffer_size += iter->buffer_size;
- }
- return buffer_size;
- }
+ size_t GetTotalBufferBlockSize() const;
const char* GetPtr(Blocks::size_type block_idx) const {
DCHECK_LT(block_idx, blocks_.size())
@@ -144,34 +134,7 @@ class BalsaBuffer {
// for reasons of efficiency, requires that the buffer from which it parses
// the headers be contiguous.
//
- void WriteToContiguousBuffer(const base::StringPiece& sp) {
- if (sp.empty()) {
- return;
- }
- CHECK(can_write_to_contiguous_buffer_);
- DCHECK_GE(blocks_.size(), 1u);
- if (blocks_[0].buffer == NULL && sp.size() <= blocksize_) {
- blocks_[0] = AllocBlock();
- memcpy(blocks_[0].start_of_unused_bytes(), sp.data(), sp.size());
- } else if (blocks_[0].bytes_free < sp.size()) {
- // the first block isn't big enough, resize it.
- const size_t old_storage_size_used = blocks_[0].bytes_used();
- const size_t new_storage_size = old_storage_size_used + sp.size();
- char* new_storage = new char[new_storage_size];
- char* old_storage = blocks_[0].buffer;
- if (old_storage_size_used) {
- memcpy(new_storage, old_storage, old_storage_size_used);
- }
- memcpy(new_storage + old_storage_size_used, sp.data(), sp.size());
- blocks_[0].buffer = new_storage;
- blocks_[0].bytes_free = sp.size();
- blocks_[0].buffer_size = new_storage_size;
- delete[] old_storage;
- } else {
- memcpy(blocks_[0].start_of_unused_bytes(), sp.data(), sp.size());
- }
- blocks_[0].bytes_free -= sp.size();
- }
+ void WriteToContiguousBuffer(const base::StringPiece& sp);
void NoMoreWriteToContiguousBuffer() {
can_write_to_contiguous_buffer_ = false;
@@ -184,79 +147,20 @@ class BalsaBuffer {
// the first block IFF the NoMoreWriteToContiguousBuffer function has
// been called since the last Clear/Construction.
base::StringPiece Write(const base::StringPiece& sp,
- Blocks::size_type* block_buffer_idx) {
- if (sp.empty()) {
- return sp;
- }
- char* storage = Reserve(sp.size(), block_buffer_idx);
- memcpy(storage, sp.data(), sp.size());
- return base::StringPiece(storage, sp.size());
- }
+ Blocks::size_type* block_buffer_idx);
// Reserves "permanent" storage of the size indicated. Returns a pointer to
// the beginning of that storage, and assigns the index of the block used to
// block_buffer_idx. This function uses the first block IFF the
// NoMoreWriteToContiguousBuffer function has been called since the last
// Clear/Construction.
- char* Reserve(size_t size,
- Blocks::size_type* block_buffer_idx) {
- // There should always be a 'first_block', even if it
- // contains nothing.
- DCHECK_GE(blocks_.size(), 1u);
- BufferBlock* block = NULL;
- Blocks::size_type block_idx = can_write_to_contiguous_buffer_ ? 1 : 0;
- for (; block_idx < blocks_.size(); ++block_idx) {
- if (blocks_[block_idx].bytes_free >= size) {
- block = &blocks_[block_idx];
- break;
- }
- }
- if (block == NULL) {
- if (blocksize_ < size) {
- blocks_.push_back(AllocCustomBlock(size));
- } else {
- blocks_.push_back(AllocBlock());
- }
- block = &blocks_.back();
- }
-
- char* storage = block->start_of_unused_bytes();
- block->bytes_free -= size;
- if (block_buffer_idx) {
- *block_buffer_idx = block_idx;
- }
- return storage;
- }
+ char* Reserve(size_t size, Blocks::size_type* block_buffer_idx);
- void Clear() {
- CHECK(!blocks_.empty());
- if (blocksize_ == blocks_[0].buffer_size) {
- CleanupBlocksStartingFrom(1);
- blocks_[0].bytes_free = blocks_[0].buffer_size;
- } else {
- CleanupBlocksStartingFrom(0);
- blocks_.push_back(AllocBlock());
- }
- DCHECK_GE(blocks_.size(), 1u);
- can_write_to_contiguous_buffer_ = true;
- }
+ void Clear();
- void Swap(BalsaBuffer* b) {
- blocks_.swap(b->blocks_);
- std::swap(can_write_to_contiguous_buffer_,
- b->can_write_to_contiguous_buffer_);
- std::swap(blocksize_, b->blocksize_);
- }
+ void Swap(BalsaBuffer* b);
- void CopyFrom(const BalsaBuffer& b) {
- CleanupBlocksStartingFrom(0);
- blocks_.resize(b.blocks_.size());
- for (Blocks::size_type i = 0; i < blocks_.size(); ++i) {
- blocks_[i] = CopyBlock(b.blocks_[i]);
- }
- blocksize_ = b.blocksize_;
- can_write_to_contiguous_buffer_ = b.can_write_to_contiguous_buffer_;
- }
+ void CopyFrom(const BalsaBuffer& b);
const char* StartOfFirstBlock() const {
return blocks_[0].buffer;
@@ -275,44 +179,20 @@ class BalsaBuffer {
size_t bytes_used(size_t idx) const { return blocks_[idx].bytes_used(); }
protected:
- BalsaBuffer() :
- blocksize_(kDefaultBlocksize), can_write_to_contiguous_buffer_(true) {
- blocks_.push_back(AllocBlock());
- }
+ BalsaBuffer();
- explicit BalsaBuffer(size_t blocksize) :
- blocksize_(blocksize), can_write_to_contiguous_buffer_(true) {
- blocks_.push_back(AllocBlock());
- }
+ explicit BalsaBuffer(size_t blocksize);
- BufferBlock AllocBlock() {
- return AllocCustomBlock(blocksize_);
- }
+ BufferBlock AllocBlock();
- BufferBlock AllocCustomBlock(size_t blocksize) {
- return BufferBlock(new char[blocksize], blocksize, blocksize);
- }
+ BufferBlock AllocCustomBlock(size_t blocksize);
- BufferBlock CopyBlock(const BufferBlock& b) {
- BufferBlock block = b;
- if (b.buffer == NULL) {
- return block;
- }
-
- block.buffer = new char[b.buffer_size];
- memcpy(block.buffer, b.buffer, b.bytes_used());
- return block;
- }
+ BufferBlock CopyBlock(const BufferBlock& b);
// Cleans up the object.
// The block at start_idx, and all subsequent blocks
// will be cleared and have associated memory deleted.
- void CleanupBlocksStartingFrom(Blocks::size_type start_idx) {
- for (Blocks::size_type i = start_idx; i < blocks_.size(); ++i) {
- delete[] blocks_[i].buffer;
- }
- blocks_.resize(start_idx);
- }
+ void CleanupBlocksStartingFrom(Blocks::size_type start_idx);
// A container of BufferBlocks
Blocks blocks_;
@@ -696,21 +576,8 @@ class BalsaHeaders {
// TODO(fenix): Revisit the amount of bytes initially allocated to the second
// block of the balsa_buffer_. It may make sense to pre-allocate some amount
// (roughly the amount we'd append in new headers such as X-User-Ip, etc.)
- BalsaHeaders() :
- balsa_buffer_(4096),
- content_length_(0),
- content_length_status_(BalsaHeadersEnums::NO_CONTENT_LENGTH),
- parsed_response_code_(0),
- firstline_buffer_base_idx_(0),
- whitespace_1_idx_(0),
- non_whitespace_1_idx_(0),
- whitespace_2_idx_(0),
- non_whitespace_2_idx_(0),
- whitespace_3_idx_(0),
- non_whitespace_3_idx_(0),
- whitespace_4_idx_(0),
- end_of_firstline_idx_(0),
- transfer_encoding_is_chunked_(false) { }
+ BalsaHeaders();
+ ~BalsaHeaders();
const_header_lines_iterator header_lines_begin() {
return HeaderLinesBeginHelper<const_header_lines_iterator>();
diff --git a/net/tools/flip_server/epoll_server.cc b/net/tools/flip_server/epoll_server.cc
index f78663c..e8219b0 100644
--- a/net/tools/flip_server/epoll_server.cc
+++ b/net/tools/flip_server/epoll_server.cc
@@ -221,6 +221,10 @@ void EpollServer::RegisterFD(int fd, CB* cb, int event_mask) {
cb->OnRegistration(this, fd, event_mask);
}
+int EpollServer::GetFlags(int fd) {
+ return fcntl(fd, F_GETFL, 0);
+}
+
void EpollServer::SetNonblocking(int fd) {
int flags = GetFlags(fd);
if (flags == -1) {
@@ -244,6 +248,13 @@ void EpollServer::SetNonblocking(int fd) {
}
}
+int EpollServer::epoll_wait_impl(int epfd,
+ struct epoll_event* events,
+ int max_events,
+ int timeout_in_ms) {
+ return epoll_wait(epfd, events, max_events, timeout_in_ms);
+}
+
void EpollServer::RegisterFDForWrite(int fd, CB* cb) {
RegisterFD(fd, cb, EPOLLOUT);
}
@@ -485,6 +496,13 @@ int64 EpollServer::NowInUsec() const {
return base::Time::Now().ToInternalValue();
}
+int64 EpollServer::ApproximateNowInUsec() const {
+ if (recorded_now_in_us_ != 0) {
+ return recorded_now_in_us_;
+ }
+ return this->NowInUsec();
+}
+
std::string EpollServer::EventMaskToString(int event_mask) {
std::string s;
if (event_mask & EPOLLIN) s += "EPOLLIN ";
diff --git a/net/tools/flip_server/epoll_server.h b/net/tools/flip_server/epoll_server.h
index bbcb188..c50afae 100644
--- a/net/tools/flip_server/epoll_server.h
+++ b/net/tools/flip_server/epoll_server.h
@@ -440,12 +440,7 @@ class EpollServer {
// Returns:
// the "approximate" current time as number of microseconds since the Unix
// epoch.
- virtual int64 ApproximateNowInUsec() const {
- if (recorded_now_in_us_ != 0) {
- return recorded_now_in_us_;
- }
- return this->NowInUsec();
- }
+ virtual int64 ApproximateNowInUsec() const;
static std::string EventMaskToString(int event_mask);
@@ -497,22 +492,19 @@ class EpollServer {
static const int kMinimumEffectiveAlarmQuantum;
protected:
- // These have to be in the .h file so that we can override them in tests.
- virtual inline int GetFlags(int fd) { return fcntl(fd, F_GETFL, 0); }
+ virtual int GetFlags(int fd);
inline int SetFlags(int fd, int flags) {
return fcntl(fd, F_SETFL, flags | O_NONBLOCK);
}
- virtual void SetNonblocking (int fd);
+ virtual void SetNonblocking(int fd);
// This exists here so that we can override this function in unittests
// in order to make effective mock EpollServer objects.
virtual int epoll_wait_impl(int epfd,
struct epoll_event* events,
int max_events,
- int timeout_in_ms) {
- return epoll_wait(epfd, events, max_events, timeout_in_ms);
- }
+ int timeout_in_ms);
// this struct is used internally, and is never used by anything external
// to this class. Some of its members are declared mutable to get around the
diff --git a/net/tools/flip_server/flip_config.cc b/net/tools/flip_server/flip_config.cc
new file mode 100644
index 0000000..0eb2273
--- /dev/null
+++ b/net/tools/flip_server/flip_config.cc
@@ -0,0 +1,139 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/tools/flip_server/flip_config.h"
+
+namespace net {
+
+FlipAcceptor::FlipAcceptor(enum FlipHandlerType flip_handler_type,
+ std::string listen_ip,
+ std::string listen_port,
+ std::string ssl_cert_filename,
+ std::string ssl_key_filename,
+ std::string http_server_ip,
+ std::string http_server_port,
+ std::string https_server_ip,
+ std::string https_server_port,
+ int spdy_only,
+ int accept_backlog_size,
+ bool disable_nagle,
+ int accepts_per_wake,
+ bool reuseport,
+ bool wait_for_iface,
+ void *memory_cache)
+ : flip_handler_type_(flip_handler_type),
+ listen_ip_(listen_ip),
+ listen_port_(listen_port),
+ ssl_cert_filename_(ssl_cert_filename),
+ ssl_key_filename_(ssl_key_filename),
+ http_server_ip_(http_server_ip),
+ http_server_port_(http_server_port),
+ https_server_ip_(https_server_ip),
+ https_server_port_(https_server_port),
+ spdy_only_(spdy_only),
+ accept_backlog_size_(accept_backlog_size),
+ disable_nagle_(disable_nagle),
+ accepts_per_wake_(accepts_per_wake),
+ memory_cache_(memory_cache),
+ ssl_session_expiry_(300), // TODO(mbelshe): Hook these up!
+ ssl_disable_compression_(false),
+ idle_socket_timeout_s_(300) {
+ VLOG(1) << "Attempting to listen on " << listen_ip_.c_str() << ":"
+ << listen_port_.c_str();
+ if (!https_server_ip_.size())
+ https_server_ip_ = http_server_ip_;
+ if (!https_server_port_.size())
+ https_server_port_ = http_server_port_;
+
+ while (1) {
+ int ret = CreateListeningSocket(listen_ip_,
+ listen_port_,
+ true,
+ accept_backlog_size_,
+ true,
+ reuseport,
+ wait_for_iface,
+ disable_nagle_,
+ &listen_fd_);
+ if ( ret == 0 ) {
+ break;
+ } else if ( ret == -3 && wait_for_iface ) {
+ // Binding error EADDRNOTAVAIL was encounted. We need
+ // to wait for the interfaces to raised. try again.
+ usleep(200000);
+ } else {
+ LOG(ERROR) << "Unable to create listening socket for: ret = " << ret
+ << ": " << listen_ip_.c_str() << ":"
+ << listen_port_.c_str();
+ return;
+ }
+ }
+
+ SetNonBlocking(listen_fd_);
+ VLOG(1) << "Listening on socket: ";
+ if (flip_handler_type == FLIP_HANDLER_PROXY)
+ VLOG(1) << "\tType : Proxy";
+ else if (FLIP_HANDLER_SPDY_SERVER)
+ VLOG(1) << "\tType : SPDY Server";
+ else if (FLIP_HANDLER_HTTP_SERVER)
+ VLOG(1) << "\tType : HTTP Server";
+ VLOG(1) << "\tIP : " << listen_ip_;
+ VLOG(1) << "\tPort : " << listen_port_;
+ VLOG(1) << "\tHTTP Server : " << http_server_ip_ << ":"
+ << http_server_port_;
+ VLOG(1) << "\tHTTPS Server : " << https_server_ip_ << ":"
+ << https_server_port_;
+ VLOG(1) << "\tSSL : "
+ << (ssl_cert_filename.size()?"true":"false");
+ VLOG(1) << "\tCertificate : " << ssl_cert_filename;
+ VLOG(1) << "\tKey : " << ssl_key_filename;
+ VLOG(1) << "\tSpdy Only : " << (spdy_only?"true":"flase");
+}
+
+FlipAcceptor::~FlipAcceptor() {}
+
+FlipConfig::FlipConfig()
+ : server_think_time_in_s_(0),
+ log_destination_(logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG),
+ wait_for_iface_(false) {
+}
+
+FlipConfig::~FlipConfig() {}
+
+void FlipConfig::AddAcceptor(enum FlipHandlerType flip_handler_type,
+ std::string listen_ip,
+ std::string listen_port,
+ std::string ssl_cert_filename,
+ std::string ssl_key_filename,
+ std::string http_server_ip,
+ std::string http_server_port,
+ std::string https_server_ip,
+ std::string https_server_port,
+ int spdy_only,
+ int accept_backlog_size,
+ bool disable_nagle,
+ int accepts_per_wake,
+ bool reuseport,
+ bool wait_for_iface,
+ void *memory_cache) {
+ // TODO(mbelshe): create a struct FlipConfigArgs{} for the arguments.
+ acceptors_.push_back(new FlipAcceptor(flip_handler_type,
+ listen_ip,
+ listen_port,
+ ssl_cert_filename,
+ ssl_key_filename,
+ http_server_ip,
+ http_server_port,
+ https_server_ip,
+ https_server_port,
+ spdy_only,
+ accept_backlog_size,
+ disable_nagle,
+ accepts_per_wake,
+ reuseport,
+ wait_for_iface,
+ memory_cache));
+}
+
+} // namespace
diff --git a/net/tools/flip_server/flip_config.h b/net/tools/flip_server/flip_config.h
index fb59e69..3c5b920 100644
--- a/net/tools/flip_server/flip_config.h
+++ b/net/tools/flip_server/flip_config.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -24,6 +24,24 @@ enum FlipHandlerType {
class FlipAcceptor {
public:
+ FlipAcceptor(enum FlipHandlerType flip_handler_type,
+ std::string listen_ip,
+ std::string listen_port,
+ std::string ssl_cert_filename,
+ std::string ssl_key_filename,
+ std::string http_server_ip,
+ std::string http_server_port,
+ std::string https_server_ip,
+ std::string https_server_port,
+ int spdy_only,
+ int accept_backlog_size,
+ bool disable_nagle,
+ int accepts_per_wake,
+ bool reuseport,
+ bool wait_for_iface,
+ void *memory_cache);
+ ~FlipAcceptor();
+
enum FlipHandlerType flip_handler_type_;
std::string listen_ip_;
std::string listen_port_;
@@ -42,109 +60,12 @@ class FlipAcceptor {
int ssl_session_expiry_;
bool ssl_disable_compression_;
int idle_socket_timeout_s_;
-
- FlipAcceptor(enum FlipHandlerType flip_handler_type,
- std::string listen_ip,
- std::string listen_port,
- std::string ssl_cert_filename,
- std::string ssl_key_filename,
- std::string http_server_ip,
- std::string http_server_port,
- std::string https_server_ip,
- std::string https_server_port,
- int spdy_only,
- int accept_backlog_size,
- bool disable_nagle,
- int accepts_per_wake,
- bool reuseport,
- bool wait_for_iface,
- void *memory_cache)
- : flip_handler_type_(flip_handler_type),
- listen_ip_(listen_ip),
- listen_port_(listen_port),
- ssl_cert_filename_(ssl_cert_filename),
- ssl_key_filename_(ssl_key_filename),
- http_server_ip_(http_server_ip),
- http_server_port_(http_server_port),
- https_server_ip_(https_server_ip),
- https_server_port_(https_server_port),
- spdy_only_(spdy_only),
- accept_backlog_size_(accept_backlog_size),
- disable_nagle_(disable_nagle),
- accepts_per_wake_(accepts_per_wake),
- memory_cache_(memory_cache),
- ssl_session_expiry_(300), // TODO(mbelshe): Hook these up!
- ssl_disable_compression_(false),
- idle_socket_timeout_s_(300) {
- VLOG(1) << "Attempting to listen on " << listen_ip_.c_str() << ":"
- << listen_port_.c_str();
- if (!https_server_ip_.size())
- https_server_ip_ = http_server_ip_;
- if (!https_server_port_.size())
- https_server_port_ = http_server_port_;
-
- while (1) {
- int ret = CreateListeningSocket(listen_ip_,
- listen_port_,
- true,
- accept_backlog_size_,
- true,
- reuseport,
- wait_for_iface,
- disable_nagle_,
- &listen_fd_);
- if ( ret == 0 ) {
- break;
- } else if ( ret == -3 && wait_for_iface ) {
- // Binding error EADDRNOTAVAIL was encounted. We need
- // to wait for the interfaces to raised. try again.
- usleep(200000);
- } else {
- LOG(ERROR) << "Unable to create listening socket for: ret = " << ret
- << ": " << listen_ip_.c_str() << ":"
- << listen_port_.c_str();
- return;
- }
- }
-
- SetNonBlocking(listen_fd_);
- VLOG(1) << "Listening on socket: ";
- if (flip_handler_type == FLIP_HANDLER_PROXY)
- VLOG(1) << "\tType : Proxy";
- else if (FLIP_HANDLER_SPDY_SERVER)
- VLOG(1) << "\tType : SPDY Server";
- else if (FLIP_HANDLER_HTTP_SERVER)
- VLOG(1) << "\tType : HTTP Server";
- VLOG(1) << "\tIP : " << listen_ip_;
- VLOG(1) << "\tPort : " << listen_port_;
- VLOG(1) << "\tHTTP Server : " << http_server_ip_ << ":"
- << http_server_port_;
- VLOG(1) << "\tHTTPS Server : " << https_server_ip_ << ":"
- << https_server_port_;
- VLOG(1) << "\tSSL : "
- << (ssl_cert_filename.size()?"true":"false");
- VLOG(1) << "\tCertificate : " << ssl_cert_filename;
- VLOG(1) << "\tKey : " << ssl_key_filename;
- VLOG(1) << "\tSpdy Only : " << (spdy_only?"true":"flase");
- }
};
class FlipConfig {
public:
- std::vector <FlipAcceptor*> acceptors_;
- double server_think_time_in_s_;
- enum logging::LoggingDestination log_destination_;
- std::string log_filename_;
- bool wait_for_iface_;
- int ssl_session_expiry_;
- bool ssl_disable_compression_;
- int idle_socket_timeout_s_;
-
- FlipConfig()
- : server_think_time_in_s_(0),
- log_destination_(logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG),
- wait_for_iface_(false) {}
- ~FlipConfig() {}
+ FlipConfig();
+ ~FlipConfig();
void AddAcceptor(enum FlipHandlerType flip_handler_type,
std::string listen_ip,
@@ -161,25 +82,16 @@ class FlipConfig {
int accepts_per_wake,
bool reuseport,
bool wait_for_iface,
- void *memory_cache) {
- // TODO(mbelshe): create a struct FlipConfigArgs{} for the arguments.
- acceptors_.push_back(new FlipAcceptor(flip_handler_type,
- listen_ip,
- listen_port,
- ssl_cert_filename,
- ssl_key_filename,
- http_server_ip,
- http_server_port,
- https_server_ip,
- https_server_port,
- spdy_only,
- accept_backlog_size,
- disable_nagle,
- accepts_per_wake,
- reuseport,
- wait_for_iface,
- memory_cache));
- }
+ void *memory_cache);
+
+ std::vector<FlipAcceptor*> acceptors_;
+ double server_think_time_in_s_;
+ enum logging::LoggingDestination log_destination_;
+ std::string log_filename_;
+ bool wait_for_iface_;
+ int ssl_session_expiry_;
+ bool ssl_disable_compression_;
+ int idle_socket_timeout_s_;
};
} // namespace
diff --git a/net/tools/flip_server/http_interface.cc b/net/tools/flip_server/http_interface.cc
index 1202336..6263f3a 100644
--- a/net/tools/flip_server/http_interface.cc
+++ b/net/tools/flip_server/http_interface.cc
@@ -74,10 +74,30 @@ void HttpSM::MessageDone() {
}
}
+void HttpSM::HandleHeaderError(BalsaFrame* framer) {
+ HandleError();
+}
+
+void HttpSM::HandleChunkingError(BalsaFrame* framer) {
+ HandleError();
+}
+
+void HttpSM::HandleBodyError(BalsaFrame* framer) {
+ HandleError();
+}
+
void HttpSM::HandleError() {
VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Error detected";
}
+void HttpSM::AddToOutputOrder(const MemCacheIter& mci) {
+ output_ordering_.AddToOutputOrder(mci);
+}
+
+void HttpSM::SendOKResponse(uint32 stream_id, std::string* output) {
+ SendOKResponseImpl(stream_id, output);
+}
+
void HttpSM::InitSMInterface(SMInterface* sm_spdy_interface,
int32 server_idx) {
sm_spdy_interface_ = sm_spdy_interface;
@@ -127,6 +147,10 @@ bool HttpSM::MessageFullyRead() const {
return http_framer_->MessageFullyRead();
}
+void HttpSM::SetStreamID(uint32 stream_id) {
+ stream_id_ = stream_id;
+}
+
bool HttpSM::Error() const {
return http_framer_->Error();
}
@@ -162,6 +186,10 @@ void HttpSM::Cleanup() {
}
}
+int HttpSM::PostAcceptHook() {
+ return 1;
+}
+
void HttpSM::NewStream(uint32 stream_id, uint32 priority,
const std::string& filename) {
MemCacheIter mci;
@@ -176,10 +204,6 @@ void HttpSM::NewStream(uint32 stream_id, uint32 priority,
}
}
-void HttpSM::AddToOutputOrder(const MemCacheIter& mci) {
- output_ordering_.AddToOutputOrder(mci);
-}
-
void HttpSM::SendEOF(uint32 stream_id) {
SendEOFImpl(stream_id);
if (acceptor_->flip_handler_type_ == FLIP_HANDLER_PROXY) {
@@ -191,10 +215,6 @@ void HttpSM::SendErrorNotFound(uint32 stream_id) {
SendErrorNotFoundImpl(stream_id);
}
-void HttpSM::SendOKResponse(uint32 stream_id, std::string* output) {
- SendOKResponseImpl(stream_id, output);
-}
-
size_t HttpSM::SendSynStream(uint32 stream_id, const BalsaHeaders& headers) {
return 0;
}
diff --git a/net/tools/flip_server/http_interface.h b/net/tools/flip_server/http_interface.h
index 282923f..ce5185e 100644
--- a/net/tools/flip_server/http_interface.h
+++ b/net/tools/flip_server/http_interface.h
@@ -32,6 +32,7 @@ class HttpSM : public BalsaVisitorInterface,
virtual ~HttpSM();
private:
+ // BalsaVisitorInterface:
virtual void ProcessBodyInput(const char *input, size_t size) {}
virtual void ProcessBodyData(const char *input, size_t size);
virtual void ProcessHeaderInput(const char *input, size_t size) {}
@@ -57,50 +58,50 @@ class HttpSM : public BalsaVisitorInterface,
virtual void ProcessChunkExtensions(const char *input, size_t size) {}
virtual void HeaderDone() {}
virtual void MessageDone();
- virtual void HandleHeaderError(BalsaFrame* framer) { HandleError(); }
+ virtual void HandleHeaderError(BalsaFrame* framer);
virtual void HandleHeaderWarning(BalsaFrame* framer) {}
- virtual void HandleChunkingError(BalsaFrame* framer) { HandleError(); }
- virtual void HandleBodyError(BalsaFrame* framer) { HandleError(); }
+ virtual void HandleChunkingError(BalsaFrame* framer);
+ virtual void HandleBodyError(BalsaFrame* framer);
void HandleError();
public:
- void InitSMInterface(SMInterface* sm_spdy_interface,
- int32 server_idx);
-
- void InitSMConnection(SMConnectionPoolInterface* connection_pool,
- SMInterface* sm_interface,
- EpollServer* epoll_server,
- int fd,
- std::string server_ip,
- std::string server_port,
- std::string remote_ip,
- bool use_ssl);
-
- size_t ProcessReadInput(const char* data, size_t len);
- size_t ProcessWriteInput(const char* data, size_t len);
- bool MessageFullyRead() const;
- void SetStreamID(uint32 stream_id) { stream_id_ = stream_id; }
- bool Error() const;
- const char* ErrorAsString() const;
- void Reset();
- void ResetForNewInterface(int32 server_idx) {}
- void ResetForNewConnection();
- void Cleanup();
- int PostAcceptHook() { return 1; }
-
- void NewStream(uint32 stream_id, uint32 priority,
- const std::string& filename);
void AddToOutputOrder(const MemCacheIter& mci);
- void SendEOF(uint32 stream_id);
- void SendErrorNotFound(uint32 stream_id);
void SendOKResponse(uint32 stream_id, std::string* output);
- size_t SendSynStream(uint32 stream_id, const BalsaHeaders& headers);
- size_t SendSynReply(uint32 stream_id, const BalsaHeaders& headers);
- void SendDataFrame(uint32 stream_id, const char* data, int64 len,
- uint32 flags, bool compress);
BalsaFrame* spdy_framer() { return http_framer_; }
+ // SMInterface:
+ virtual void InitSMInterface(SMInterface* sm_spdy_interface,
+ int32 server_idx);
+ virtual void InitSMConnection(SMConnectionPoolInterface* connection_pool,
+ SMInterface* sm_interface,
+ EpollServer* epoll_server,
+ int fd,
+ std::string server_ip,
+ std::string server_port,
+ std::string remote_ip,
+ bool use_ssl);
+ virtual size_t ProcessReadInput(const char* data, size_t len);
+ virtual size_t ProcessWriteInput(const char* data, size_t len);
+ virtual bool MessageFullyRead() const;
+ virtual void SetStreamID(uint32 stream_id);
+ virtual bool Error() const;
+ virtual const char* ErrorAsString() const;
+ virtual void Reset();
+ virtual void ResetForNewInterface(int32 server_idx) {}
+ virtual void ResetForNewConnection();
+ virtual void Cleanup();
+ virtual int PostAcceptHook();
+
+ virtual void NewStream(uint32 stream_id, uint32 priority,
+ const std::string& filename);
+ virtual void SendEOF(uint32 stream_id);
+ virtual void SendErrorNotFound(uint32 stream_id);
+ virtual size_t SendSynStream(uint32 stream_id, const BalsaHeaders& headers);
+ virtual size_t SendSynReply(uint32 stream_id, const BalsaHeaders& headers);
+ virtual void SendDataFrame(uint32 stream_id, const char* data, int64 len,
+ uint32 flags, bool compress);
+
private:
void SendEOFImpl(uint32 stream_id);
void SendErrorNotFoundImpl(uint32 stream_id);
@@ -110,7 +111,8 @@ class HttpSM : public BalsaVisitorInterface,
void SendDataFrameImpl(uint32 stream_id, const char* data, int64 len,
uint32 flags, bool compress);
void EnqueueDataFrame(DataFrame* df);
- void GetOutput();
+ virtual void GetOutput();
+
private:
uint64 seq_num_;
BalsaFrame* http_framer_;
diff --git a/net/tools/flip_server/mem_cache.cc b/net/tools/flip_server/mem_cache.cc
index bf06263..85b9fe3 100644
--- a/net/tools/flip_server/mem_cache.cc
+++ b/net/tools/flip_server/mem_cache.cc
@@ -24,6 +24,58 @@ std::string FLAGS_cache_base_dir = ".";
namespace net {
+void StoreBodyAndHeadersVisitor::ProcessBodyData(const char *input,
+ size_t size) {
+ body.append(input, size);
+}
+
+void StoreBodyAndHeadersVisitor::HandleHeaderError(BalsaFrame* framer) {
+ HandleError();
+}
+
+void StoreBodyAndHeadersVisitor::HandleHeaderWarning(BalsaFrame* framer) {
+ HandleError();
+}
+
+void StoreBodyAndHeadersVisitor::HandleChunkingError(BalsaFrame* framer) {
+ HandleError();
+}
+
+void StoreBodyAndHeadersVisitor::HandleBodyError(BalsaFrame* framer) {
+ HandleError();
+}
+
+FileData::FileData(BalsaHeaders* h, const std::string& b)
+ : headers(h), body(b) {
+}
+
+FileData::FileData() {}
+
+FileData::~FileData() {}
+
+void FileData::CopyFrom(const FileData& file_data) {
+ headers = new BalsaHeaders;
+ headers->CopyFrom(*(file_data.headers));
+ filename = file_data.filename;
+ related_files = file_data.related_files;
+ body = file_data.body;
+ }
+
+MemoryCache::MemoryCache() {}
+
+MemoryCache::~MemoryCache() {}
+
+void MemoryCache::CloneFrom(const MemoryCache& mc) {
+ for (Files::const_iterator i = mc.files_.begin();
+ i != mc.files_.end();
+ ++i) {
+ Files::iterator out_i =
+ files_.insert(make_pair(i->first, FileData())).first;
+ out_i->second.CopyFrom(i->second);
+ cwd_ = mc.cwd_;
+ }
+}
+
void MemoryCache::AddFiles() {
std::deque<std::string> paths;
cwd_ = FLAGS_cache_base_dir;
diff --git a/net/tools/flip_server/mem_cache.h b/net/tools/flip_server/mem_cache.h
index 11450ec..a7187bf 100644
--- a/net/tools/flip_server/mem_cache.h
+++ b/net/tools/flip_server/mem_cache.h
@@ -17,14 +17,11 @@ namespace net {
class StoreBodyAndHeadersVisitor: public BalsaVisitorInterface {
public:
- BalsaHeaders headers;
- std::string body;
- bool error_;
+ void HandleError() { error_ = true; }
+ // BalsaVisitorInterface:
virtual void ProcessBodyInput(const char *input, size_t size) {}
- virtual void ProcessBodyData(const char *input, size_t size) {
- body.append(input, size);
- }
+ virtual void ProcessBodyData(const char *input, size_t size);
virtual void ProcessHeaderInput(const char *input, size_t size) {}
virtual void ProcessTrailerInput(const char *input, size_t size) {}
virtual void ProcessHeaders(const BalsaHeaders& headers) {
@@ -51,26 +48,23 @@ class StoreBodyAndHeadersVisitor: public BalsaVisitorInterface {
virtual void ProcessChunkExtensions(const char *input, size_t size) {}
virtual void HeaderDone() {}
virtual void MessageDone() {}
- virtual void HandleHeaderError(BalsaFrame* framer) { HandleError(); }
- virtual void HandleHeaderWarning(BalsaFrame* framer) { HandleError(); }
- virtual void HandleChunkingError(BalsaFrame* framer) { HandleError(); }
- virtual void HandleBodyError(BalsaFrame* framer) { HandleError(); }
+ virtual void HandleHeaderError(BalsaFrame* framer);
+ virtual void HandleHeaderWarning(BalsaFrame* framer);
+ virtual void HandleChunkingError(BalsaFrame* framer);
+ virtual void HandleBodyError(BalsaFrame* framer);
- void HandleError() { error_ = true; }
+ BalsaHeaders headers;
+ std::string body;
+ bool error_;
};
////////////////////////////////////////////////////////////////////////////////
struct FileData {
- void CopyFrom(const FileData& file_data) {
- headers = new BalsaHeaders;
- headers->CopyFrom(*(file_data.headers));
- filename = file_data.filename;
- related_files = file_data.related_files;
- body = file_data.body;
- }
- FileData(BalsaHeaders* h, const std::string& b) : headers(h), body(b) {}
- FileData() {}
+ FileData();
+ FileData(BalsaHeaders* h, const std::string& b);
+ ~FileData();
+ void CopyFrom(const FileData& file_data);
BalsaHeaders* headers;
std::string filename;
@@ -115,19 +109,10 @@ class MemoryCache {
typedef std::map<std::string, FileData> Files;
public:
- Files files_;
- std::string cwd_;
+ MemoryCache();
+ ~MemoryCache();
- void CloneFrom(const MemoryCache& mc) {
- for (Files::const_iterator i = mc.files_.begin();
- i != mc.files_.end();
- ++i) {
- Files::iterator out_i =
- files_.insert(make_pair(i->first, FileData())).first;
- out_i->second.CopyFrom(i->second);
- cwd_ = mc.cwd_;
- }
- }
+ void CloneFrom(const MemoryCache& mc);
void AddFiles();
@@ -138,6 +123,9 @@ class MemoryCache {
FileData* GetFileData(const std::string& filename);
bool AssignFileData(const std::string& filename, MemCacheIter* mci);
+
+ Files files_;
+ std::string cwd_;
};
class NotifierInterface {
diff --git a/net/tools/flip_server/output_ordering.cc b/net/tools/flip_server/output_ordering.cc
index 101f668..409ec0a 100644
--- a/net/tools/flip_server/output_ordering.cc
+++ b/net/tools/flip_server/output_ordering.cc
@@ -20,6 +20,8 @@ OutputOrdering::OutputOrdering(SMConnectionInterface* connection)
epoll_server_ = connection->epoll_server();
}
+OutputOrdering::~OutputOrdering() {}
+
void OutputOrdering::Reset() {
while (!stream_ids_.empty()) {
StreamIdToPriorityMap::iterator sitpmi = stream_ids_.begin();
@@ -38,6 +40,45 @@ bool OutputOrdering::ExistsInPriorityMaps(uint32 stream_id) {
return sitpmi != stream_ids_.end();
}
+OutputOrdering::BeginOutputtingAlarm::BeginOutputtingAlarm(
+ OutputOrdering* oo,
+ OutputOrdering::PriorityMapPointer* pmp,
+ const MemCacheIter& mci)
+ : output_ordering_(oo),
+ pmp_(pmp),
+ mci_(mci),
+ epoll_server_(NULL) {
+}
+
+OutputOrdering::BeginOutputtingAlarm::~BeginOutputtingAlarm() {
+ if (epoll_server_ && pmp_->alarm_enabled)
+ epoll_server_->UnregisterAlarm(pmp_->alarm_token);
+}
+
+int64 OutputOrdering::BeginOutputtingAlarm::OnAlarm() {
+ OnUnregistration();
+ output_ordering_->MoveToActive(pmp_, mci_);
+ VLOG(2) << "ON ALARM! Should now start to output...";
+ delete this;
+ return 0;
+}
+
+void OutputOrdering::BeginOutputtingAlarm::OnRegistration(
+ const EpollServer::AlarmRegToken& tok,
+ EpollServer* eps) {
+ epoll_server_ = eps;
+ pmp_->alarm_token = tok;
+ pmp_->alarm_enabled = true;
+}
+
+void OutputOrdering::BeginOutputtingAlarm::OnUnregistration() {
+ pmp_->alarm_enabled = false;
+}
+
+void OutputOrdering::BeginOutputtingAlarm::OnShutdown(EpollServer* eps) {
+ OnUnregistration();
+}
+
void OutputOrdering::MoveToActive(PriorityMapPointer* pmp, MemCacheIter mci) {
VLOG(2) << "Moving to active!";
first_data_senders_.push_back(mci);
diff --git a/net/tools/flip_server/output_ordering.h b/net/tools/flip_server/output_ordering.h
index 14c1587..659775f 100644
--- a/net/tools/flip_server/output_ordering.h
+++ b/net/tools/flip_server/output_ordering.h
@@ -42,6 +42,7 @@ class OutputOrdering {
EpollServer* epoll_server_;
explicit OutputOrdering(SMConnectionInterface* connection);
+ ~OutputOrdering();
void Reset();
bool ExistsInPriorityMaps(uint32 stream_id);
@@ -49,32 +50,16 @@ class OutputOrdering {
public:
BeginOutputtingAlarm(OutputOrdering* oo,
OutputOrdering::PriorityMapPointer* pmp,
- const MemCacheIter& mci) :
- output_ordering_(oo), pmp_(pmp), mci_(mci), epoll_server_(NULL) {}
-
- int64 OnAlarm() {
- OnUnregistration();
- output_ordering_->MoveToActive(pmp_, mci_);
- VLOG(2) << "ON ALARM! Should now start to output...";
- delete this;
- return 0;
- }
- void OnRegistration(const EpollServer::AlarmRegToken& tok,
- EpollServer* eps) {
- epoll_server_ = eps;
- pmp_->alarm_token = tok;
- pmp_->alarm_enabled = true;
- }
- void OnUnregistration() {
- pmp_->alarm_enabled = false;
- }
- void OnShutdown(EpollServer* eps) {
- OnUnregistration();
- }
- ~BeginOutputtingAlarm() {
- if (epoll_server_ && pmp_->alarm_enabled)
- epoll_server_->UnregisterAlarm(pmp_->alarm_token);
- }
+ const MemCacheIter& mci);
+ virtual ~BeginOutputtingAlarm();
+
+ // EpollAlarmCallbackInterface:
+ virtual int64 OnAlarm();
+ virtual void OnRegistration(const EpollServer::AlarmRegToken& tok,
+ EpollServer* eps);
+ virtual void OnUnregistration();
+ virtual void OnShutdown(EpollServer* eps);
+
private:
OutputOrdering* output_ordering_;
OutputOrdering::PriorityMapPointer* pmp_;
diff --git a/net/tools/flip_server/ring_buffer.cc b/net/tools/flip_server/ring_buffer.cc
index 2662edf..81e9e9e 100644
--- a/net/tools/flip_server/ring_buffer.cc
+++ b/net/tools/flip_server/ring_buffer.cc
@@ -15,6 +15,8 @@ RingBuffer::RingBuffer(int buffer_size)
write_idx_(0) {
}
+RingBuffer::~RingBuffer() {}
+
////////////////////////////////////////////////////////////////////////////////
int RingBuffer::ReadableBytes() const {
@@ -35,6 +37,18 @@ int RingBuffer::BytesFree() const {
////////////////////////////////////////////////////////////////////////////////
+bool RingBuffer::Empty() const {
+ return ReadableBytes() == 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+bool RingBuffer::Full() const {
+ return ReadableBytes() == BufferSize();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
// Returns the number of characters written.
// Appends up-to-'size' bytes to the ringbuffer.
int RingBuffer::Write(const char* bytes, int size) {
diff --git a/net/tools/flip_server/ring_buffer.h b/net/tools/flip_server/ring_buffer.h
index 75ad0ec3..ac482b6 100644
--- a/net/tools/flip_server/ring_buffer.h
+++ b/net/tools/flip_server/ring_buffer.h
@@ -26,7 +26,7 @@ namespace net {
class RingBuffer : public BufferInterface {
public:
explicit RingBuffer(int buffer_size);
- virtual ~RingBuffer() { }
+ virtual ~RingBuffer();
// Resize the buffer to the size specified here. If the buffer_size passed
// in here is smaller than the amount of data in the buffer, then the oldest
@@ -42,8 +42,8 @@ class RingBuffer : public BufferInterface {
virtual int BufferSize() const;
virtual int BytesFree() const;
- virtual bool Empty() const { return ReadableBytes() == 0; }
- virtual bool Full() const { return ReadableBytes() == BufferSize(); }
+ virtual bool Empty() const;
+ virtual bool Full() const;
// returns the number of characters written.
// appends up-to-'size' bytes to the ringbuffer.
diff --git a/net/tools/flip_server/sm_connection.cc b/net/tools/flip_server/sm_connection.cc
index be1e8db..b1dc3c8 100644
--- a/net/tools/flip_server/sm_connection.cc
+++ b/net/tools/flip_server/sm_connection.cc
@@ -55,6 +55,10 @@ SMConnection::~SMConnection() {
Reset();
}
+EpollServer* SMConnection::epoll_server() {
+ return epoll_server_;
+}
+
void SMConnection::ReadyToSend() {
VLOG(2) << log_prefix_ << ACCEPTOR_CLIENT_IDENT
<< "Setting ready to send: EPOLLIN | EPOLLOUT";
@@ -215,6 +219,10 @@ int SMConnection::Send(const char* data, int len, int flags) {
return rv;
}
+void SMConnection::OnRegistration(EpollServer* eps, int fd, int event_mask) {
+ registered_in_epoll_server_ = true;
+}
+
void SMConnection::OnEvent(int fd, EpollEvent* event) {
events_ |= event->in_events;
HandleEvents();
@@ -223,6 +231,11 @@ void SMConnection::OnEvent(int fd, EpollEvent* event) {
events_ = 0;
}
}
+
+void SMConnection::OnUnregistration(int fd, bool replaced) {
+ registered_in_epoll_server_ = false;
+}
+
void SMConnection::OnShutdown(EpollServer* eps, int fd) {
Cleanup("OnShutdown");
return;
diff --git a/net/tools/flip_server/sm_connection.h b/net/tools/flip_server/sm_connection.h
index 62d50a0..044f311 100644
--- a/net/tools/flip_server/sm_connection.h
+++ b/net/tools/flip_server/sm_connection.h
@@ -57,10 +57,10 @@ class SMConnection : public SMConnectionInterface,
std::string server_ip_;
std::string server_port_;
- EpollServer* epoll_server() { return epoll_server_; }
+ virtual EpollServer* epoll_server();
OutputList* output_list() { return &output_list_; }
MemoryCache* memory_cache() { return memory_cache_; }
- void ReadyToSend();
+ virtual void ReadyToSend();
void EnqueueDataFrame(DataFrame* df);
int fd() const { return fd_; }
@@ -82,14 +82,10 @@ class SMConnection : public SMConnectionInterface,
int Send(const char* data, int len, int flags);
// EpollCallbackInterface interface.
- virtual void OnRegistration(EpollServer* eps, int fd, int event_mask) {
- registered_in_epoll_server_ = true;
- }
+ virtual void OnRegistration(EpollServer* eps, int fd, int event_mask);
virtual void OnModification(int fd, int event_mask) {}
virtual void OnEvent(int fd, EpollEvent* event);
- virtual void OnUnregistration(int fd, bool replaced) {
- registered_in_epoll_server_ = false;
- }
+ virtual void OnUnregistration(int fd, bool replaced);
virtual void OnShutdown(EpollServer* eps, int fd);
// NotifierInterface interface.
diff --git a/net/tools/flip_server/spdy_interface.h b/net/tools/flip_server/spdy_interface.h
index 34f2716..64b397d 100644
--- a/net/tools/flip_server/spdy_interface.h
+++ b/net/tools/flip_server/spdy_interface.h
@@ -33,17 +33,17 @@ class SpdySM : public spdy::SpdyFramerVisitorInterface,
FlipAcceptor* acceptor);
virtual ~SpdySM();
- void InitSMInterface(SMInterface* sm_http_interface,
- int32 server_idx) { }
-
- void InitSMConnection(SMConnectionPoolInterface* connection_pool,
- SMInterface* sm_interface,
- EpollServer* epoll_server,
- int fd,
- std::string server_ip,
- std::string server_port,
- std::string remote_ip,
- bool use_ssl);
+ virtual void InitSMInterface(SMInterface* sm_http_interface,
+ int32 server_idx) {}
+
+ virtual void InitSMConnection(SMConnectionPoolInterface* connection_pool,
+ SMInterface* sm_interface,
+ EpollServer* epoll_server,
+ int fd,
+ std::string server_ip,
+ std::string server_port,
+ std::string remote_ip,
+ bool use_ssl);
static bool disable_data_compression() { return disable_data_compression_; }
static void set_disable_data_compression(bool value) {
@@ -65,34 +65,34 @@ class SpdySM : public spdy::SpdyFramerVisitorInterface,
const char* data, size_t len);
public:
- size_t ProcessReadInput(const char* data, size_t len);
- size_t ProcessWriteInput(const char* data, size_t len);
- bool MessageFullyRead() const;
- void SetStreamID(uint32 stream_id) {}
- bool Error() const;
- const char* ErrorAsString() const;
- void Reset() { }
- void ResetForNewInterface(int32 server_idx);
- void ResetForNewConnection();
+ virtual size_t ProcessReadInput(const char* data, size_t len);
+ virtual size_t ProcessWriteInput(const char* data, size_t len);
+ virtual bool MessageFullyRead() const;
+ virtual void SetStreamID(uint32 stream_id) {}
+ virtual bool Error() const;
+ virtual const char* ErrorAsString() const;
+ virtual void Reset() {}
+ virtual void ResetForNewInterface(int32 server_idx);
+ virtual void ResetForNewConnection();
// SMInterface's Cleanup is currently only called by SMConnection after a
// protocol message as been fully read. Spdy's SMInterface does not need
// to do any cleanup at this time.
// TODO (klindsay) This method is probably not being used properly and
// some logic review and method renaming is probably in order.
- void Cleanup() {}
+ virtual void Cleanup() {}
// Send a settings frame
- int PostAcceptHook();
- void NewStream(uint32 stream_id,
- uint32 priority,
- const std::string& filename);
+ virtual int PostAcceptHook();
+ virtual void NewStream(uint32 stream_id,
+ uint32 priority,
+ const std::string& filename);
void AddToOutputOrder(const MemCacheIter& mci);
- void SendEOF(uint32 stream_id);
- void SendErrorNotFound(uint32 stream_id);
+ virtual void SendEOF(uint32 stream_id);
+ virtual void SendErrorNotFound(uint32 stream_id);
void SendOKResponse(uint32 stream_id, std::string* output);
- size_t SendSynStream(uint32 stream_id, const BalsaHeaders& headers);
- size_t SendSynReply(uint32 stream_id, const BalsaHeaders& headers);
- void SendDataFrame(uint32 stream_id, const char* data, int64 len,
- uint32 flags, bool compress);
+ virtual size_t SendSynStream(uint32 stream_id, const BalsaHeaders& headers);
+ virtual size_t SendSynReply(uint32 stream_id, const BalsaHeaders& headers);
+ virtual void SendDataFrame(uint32 stream_id, const char* data, int64 len,
+ uint32 flags, bool compress);
spdy::SpdyFramer* spdy_framer() { return spdy_framer_; }
static std::string forward_ip_header() { return forward_ip_header_; }
@@ -111,7 +111,7 @@ class SpdySM : public spdy::SpdyFramerVisitorInterface,
void SendDataFrameImpl(uint32 stream_id, const char* data, int64 len,
spdy::SpdyDataFlags flags, bool compress);
void EnqueueDataFrame(DataFrame* df);
- void GetOutput();
+ virtual void GetOutput();
private:
uint64 seq_num_;
spdy::SpdyFramer* spdy_framer_;
diff --git a/net/tools/flip_server/streamer_interface.cc b/net/tools/flip_server/streamer_interface.cc
index e29ff19..bbcb69a 100644
--- a/net/tools/flip_server/streamer_interface.cc
+++ b/net/tools/flip_server/streamer_interface.cc
@@ -63,11 +63,27 @@ size_t StreamerSM::ProcessWriteInput(const char* data, size_t len) {
return len;
}
+bool StreamerSM::MessageFullyRead() const {
+ return false;
+}
+
+bool StreamerSM::Error() const {
+ return false;
+}
+
+const char* StreamerSM::ErrorAsString() const {
+ return "(none)";
+}
+
void StreamerSM::Reset() {
VLOG(1) << ACCEPTOR_CLIENT_IDENT << "StreamerSM: Reset";
connection_->Cleanup("Server Reset");
}
+void StreamerSM::ResetForNewConnection() {
+ sm_other_interface_->Reset();
+}
+
int StreamerSM::PostAcceptHook() {
if (!sm_other_interface_) {
SMConnection *server_connection =
@@ -95,5 +111,14 @@ int StreamerSM::PostAcceptHook() {
return 1;
}
+size_t StreamerSM::SendSynStream(uint32 stream_id,
+ const BalsaHeaders& headers) {
+ return 0;
+}
+
+size_t StreamerSM::SendSynReply(uint32 stream_id, const BalsaHeaders& headers) {
+ return 0;
+}
+
} // namespace net
diff --git a/net/tools/flip_server/streamer_interface.h b/net/tools/flip_server/streamer_interface.h
index 67b218b..de3dd94 100644
--- a/net/tools/flip_server/streamer_interface.h
+++ b/net/tools/flip_server/streamer_interface.h
@@ -24,42 +24,39 @@ class StreamerSM : public SMInterface {
FlipAcceptor* acceptor);
virtual ~StreamerSM();
- void InitSMInterface(SMInterface* sm_other_interface,
- int32 server_idx);
- void InitSMConnection(SMConnectionPoolInterface* connection_pool,
- SMInterface* sm_interface,
- EpollServer* epoll_server,
- int fd,
- std::string server_ip,
- std::string server_port,
- std::string remote_ip,
- bool use_ssl);
-
- size_t ProcessReadInput(const char* data, size_t len);
- size_t ProcessWriteInput(const char* data, size_t len);
- bool MessageFullyRead() const { return false; }
- void SetStreamID(uint32 stream_id) {}
- bool Error() const { return false; }
- const char* ErrorAsString() const { return "(none)"; }
- void Reset();
- void ResetForNewInterface(int32 server_idx) {}
- void ResetForNewConnection() { sm_other_interface_->Reset(); }
- void Cleanup() {}
- int PostAcceptHook();
- void NewStream(uint32 stream_id, uint32 priority,
- const std::string& filename) {}
void AddToOutputOrder(const MemCacheIter& mci) {}
- void SendEOF(uint32 stream_id) {}
- void SendErrorNotFound(uint32 stream_id) {}
- void SendOKResponse(uint32 stream_id, std::string output) {}
- size_t SendSynStream(uint32 stream_id, const BalsaHeaders& headers) {
- return 0;
- }
- size_t SendSynReply(uint32 stream_id, const BalsaHeaders& headers) {
- return 0;
- }
- void SendDataFrame(uint32 stream_id, const char* data, int64 len,
- uint32 flags, bool compress) {}
+
+ virtual void InitSMInterface(SMInterface* sm_other_interface,
+ int32 server_idx);
+ virtual void InitSMConnection(SMConnectionPoolInterface* connection_pool,
+ SMInterface* sm_interface,
+ EpollServer* epoll_server,
+ int fd,
+ std::string server_ip,
+ std::string server_port,
+ std::string remote_ip,
+ bool use_ssl);
+
+ virtual size_t ProcessReadInput(const char* data, size_t len);
+ virtual size_t ProcessWriteInput(const char* data, size_t len);
+ virtual bool MessageFullyRead() const;
+ virtual void SetStreamID(uint32 stream_id) {}
+ virtual bool Error() const;
+ virtual const char* ErrorAsString() const;
+ virtual void Reset();
+ virtual void ResetForNewInterface(int32 server_idx) {}
+ virtual void ResetForNewConnection();
+ virtual void Cleanup() {}
+ virtual int PostAcceptHook();
+ virtual void NewStream(uint32 stream_id, uint32 priority,
+ const std::string& filename) {}
+ virtual void SendEOF(uint32 stream_id) {}
+ virtual void SendErrorNotFound(uint32 stream_id) {}
+ virtual void SendOKResponse(uint32 stream_id, std::string output) {}
+ virtual size_t SendSynStream(uint32 stream_id, const BalsaHeaders& headers);
+ virtual size_t SendSynReply(uint32 stream_id, const BalsaHeaders& headers);
+ virtual void SendDataFrame(uint32 stream_id, const char* data, int64 len,
+ uint32 flags, bool compress) {}
private:
void SendEOFImpl(uint32 stream_id) {}
@@ -73,7 +70,7 @@ class StreamerSM : public SMInterface {
}
void SendDataFrameImpl(uint32 stream_id, const char* data, int64 len,
uint32 flags, bool compress) {}
- void GetOutput() {}
+ virtual void GetOutput() {}
SMConnection* connection_;
SMInterface* sm_other_interface_;