\r
class connection : public spl::enable_shared_from_this<connection>\r
{ \r
- spl::shared_ptr<tcp::socket> socket_; \r
- boost::optional<std::regex> regex_;\r
+ const spl::shared_ptr<tcp::socket> socket_; \r
+ const spl::shared_ptr<connection_set> connection_set_;\r
\r
- std::array<char, 8192> data_;\r
- \r
- spl::shared_ptr<connection_set> connection_set_;\r
-\r
- std::string input_;\r
+ boost::optional<std::regex> regex_;\r
+ std::array<char, 32768> data_;\r
+ std::string input_;\r
\r
public:\r
static spl::shared_ptr<connection> create(spl::shared_ptr<tcp::socket> socket, spl::shared_ptr<connection_set> connection_set)\r
} \r
else if (error != boost::asio::error::operation_aborted) \r
stop(); \r
- else\r
- read_some();\r
}\r
\r
void handle_write(const spl::shared_ptr<std::vector<char>>& data, const boost::system::error_code& error, size_t bytes_transferred)\r
\r
class connection : public spl::enable_shared_from_this<connection>, public ClientInfo\r
{ \r
- spl::shared_ptr<tcp::socket> socket_; \r
+ const spl::shared_ptr<tcp::socket> socket_; \r
+ const spl::shared_ptr<connection_set> connection_set_;\r
const std::wstring name_;\r
+ const spl::shared_ptr<IProtocolStrategy> protocol_;\r
\r
std::array<char, 32768> data_;\r
-\r
- std::string buffer_;\r
-\r
- const spl::shared_ptr<IProtocolStrategy> protocol_;\r
- spl::shared_ptr<connection_set> connection_set_;\r
+ std::string input_;\r
\r
public:\r
static spl::shared_ptr<connection> create(spl::shared_ptr<tcp::socket> socket, const ProtocolStrategyPtr& protocol, spl::shared_ptr<connection_set> connection_set)\r
connection(const spl::shared_ptr<tcp::socket>& socket, const ProtocolStrategyPtr& protocol, const spl::shared_ptr<connection_set>& connection_set) \r
: socket_(socket)\r
, name_((socket_->is_open() ? u16(socket_->local_endpoint().address().to_string() + ":" + boost::lexical_cast<std::string>(socket_->local_endpoint().port())) : L"no-address"))\r
- , protocol_(protocol)\r
, connection_set_(connection_set)\r
+ , protocol_(protocol)\r
{\r
CASPAR_LOG(info) << print() << L" Connected.";\r
}\r
{\r
CASPAR_LOG(trace) << print() << L" Received: " << u16(std::string(data_.begin(), data_.begin() + bytes_transferred));\r
\r
- buffer_.insert(buffer_.end(), data_.begin(), data_.begin() + bytes_transferred);\r
+ input_.append(data_.begin(), data_.begin() + bytes_transferred);\r
\r
std::vector<std::string> split;\r
- boost::iter_split(split, buffer_, boost::algorithm::first_finder("\r\n"));\r
+ boost::iter_split(split, input_, boost::algorithm::first_finder("\r\n"));\r
\r
- buffer_ = std::move(split.back());\r
+ input_ = std::move(split.back());\r
split.pop_back();\r
\r
BOOST_FOREACH(auto cmd, split)\r
} \r
else if (error != boost::asio::error::operation_aborted)\r
stop(); \r
- else\r
- read_some();\r
}\r
\r
void handle_write(const spl::shared_ptr<std::string>& data, const boost::system::error_code& error, size_t bytes_transferred)\r