mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
fixes for network errors discovered with new connection stress test example
This commit is contained in:
26
examples/broadcast_server_tls/Makefile
Normal file
26
examples/broadcast_server_tls/Makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
BOOST_LIB_PATH ?= /usr/local/lib
|
||||
BOOST_INCLUDE_PATH ?= /usr/local/include
|
||||
|
||||
CFLAGS = -O2 -I$(BOOST_INCLUDE_PATH)
|
||||
LDFLAGS = -L$(BOOST_LIB_PATH)
|
||||
|
||||
CXX ?= c++
|
||||
SHARED ?= "1"
|
||||
|
||||
ifeq ($(SHARED), 1)
|
||||
LDFLAGS := $(LDFLAGS) -lboost_system -lboost_date_time -lcrypto -lssl -lwebsocketpp
|
||||
else
|
||||
LDFLAGS := $(LDFLAGS) $(BOOST_LIB_PATH)/libboost_system.a $(BOOST_LIB_PATH)/libboost_date_time.a $(BOOST_LIB_PATH)/libboost_regex.a -lcrypto -lssl ../../libwebsocketpp.a
|
||||
endif
|
||||
|
||||
broadcast_server: broadcast_server_tls.o
|
||||
$(CXX) $(CFLAGS) $^ -o $@ $(LDFLAGS)
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) -c $(CFLAGS) -o $@ $^
|
||||
|
||||
# cleanup by removing generated files
|
||||
#
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f *.o broadcast_server
|
||||
94
examples/broadcast_server_tls/broadcast_admin.html
Normal file
94
examples/broadcast_server_tls/broadcast_admin.html
Normal file
@@ -0,0 +1,94 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="text/javascript">
|
||||
var ws;
|
||||
var url;
|
||||
|
||||
function connect() {
|
||||
url = document.getElementById("server_url").value;
|
||||
console.log(url);
|
||||
|
||||
if ("WebSocket" in window) {
|
||||
ws = new WebSocket(url);
|
||||
} else if ("MozWebSocket" in window) {
|
||||
ws = new MozWebSocket(url);
|
||||
} else {
|
||||
document.getElementById("messages").innerHTML += "This Browser does not support WebSockets<br />";
|
||||
return;
|
||||
}
|
||||
ws.onopen = function(e) {
|
||||
document.getElementById("messages").innerHTML += "Client: A connection to "+ws.URL+" has been opened.<br />";
|
||||
|
||||
document.getElementById("server_url").disabled = true;
|
||||
document.getElementById("toggle_connect").innerHTML = "Disconnect";
|
||||
};
|
||||
|
||||
ws.onerror = function(e) {
|
||||
document.getElementById("messages").innerHTML += "Client: An error occured, see console log for more details.<br />";
|
||||
console.log(e);
|
||||
};
|
||||
|
||||
ws.onclose = function(e) {
|
||||
document.getElementById("messages").innerHTML += "Client: The connection to "+url+" was closed.<br />";
|
||||
};
|
||||
|
||||
ws.onmessage = function(e) {
|
||||
document.getElementById("messages").innerHTML += "Server: "+e.data+"<br />";
|
||||
};
|
||||
}
|
||||
|
||||
function disconnect() {
|
||||
ws.close();
|
||||
document.getElementById("server_url").disabled = false;
|
||||
document.getElementById("toggle_connect").innerHTML = "Connect";
|
||||
}
|
||||
|
||||
function toggle_connect() {
|
||||
if (document.getElementById("server_url").disabled === false) {
|
||||
connect();
|
||||
} else {
|
||||
disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
function send() {
|
||||
if (ws === undefined || ws.readyState != 1) {
|
||||
document.getElementById("messages").innerHTML += "Client: Websocket is not avaliable for writing<br />";
|
||||
return;
|
||||
}
|
||||
|
||||
ws.send(document.getElementById("msg").value);
|
||||
document.getElementById("msg").value = "";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
body,html {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
#controls {
|
||||
float:right;
|
||||
background-color: #999;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="controls">
|
||||
<div id="server">
|
||||
<input type="text" name="server_url" id="server_url" value="ws://localhost:5000" />
|
||||
<button id="toggle_connect" onclick="toggle_connect();">Connect</button>
|
||||
</div>
|
||||
|
||||
<div id="message_input"><input type="text" name="msg" id="msg" value="Hello World!" />
|
||||
<button onclick="send();">Send</button></div>
|
||||
</div>
|
||||
<div id="messages"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
BIN
examples/broadcast_server_tls/broadcast_server
Executable file
BIN
examples/broadcast_server_tls/broadcast_server
Executable file
Binary file not shown.
148
examples/broadcast_server_tls/broadcast_server_tls.cpp
Normal file
148
examples/broadcast_server_tls/broadcast_server_tls.cpp
Normal file
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Peter Thorson. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the WebSocket++ Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../src/endpoint.hpp"
|
||||
#include "../../src/roles/server.hpp"
|
||||
#include "../../src/sockets/ssl.hpp"
|
||||
|
||||
#include <cstring>
|
||||
#include <set>
|
||||
|
||||
typedef websocketpp::endpoint<websocketpp::role::server,websocketpp::socket::plain> plain_endpoint_type;
|
||||
typedef plain_endpoint_type::handler_ptr plain_handler_ptr;
|
||||
|
||||
typedef websocketpp::endpoint<websocketpp::role::server,websocketpp::socket::ssl> tls_endpoint_type;
|
||||
typedef tls_endpoint_type::handler_ptr tls_handler_ptr;
|
||||
|
||||
template <typename endpoint_type>
|
||||
class broadcast_server_handler : public endpoint_type::handler {
|
||||
public:
|
||||
typedef broadcast_server_handler<endpoint_type> type;
|
||||
typedef typename endpoint_type::connection_ptr connection_ptr;
|
||||
|
||||
std::string get_password() const {
|
||||
return "test";
|
||||
}
|
||||
|
||||
boost::shared_ptr<boost::asio::ssl::context> on_tls_init() {
|
||||
// create a tls context, init, and return.
|
||||
boost::shared_ptr<boost::asio::ssl::context> context(new boost::asio::ssl::context(boost::asio::ssl::context::tlsv1));
|
||||
try {
|
||||
context->set_options(boost::asio::ssl::context::default_workarounds |
|
||||
boost::asio::ssl::context::no_sslv2 |
|
||||
boost::asio::ssl::context::single_dh_use);
|
||||
context->set_password_callback(boost::bind(&type::get_password, this));
|
||||
context->use_certificate_chain_file("../../src/ssl/server.pem");
|
||||
context->use_private_key_file("../../src/ssl/server.pem", boost::asio::ssl::context::pem);
|
||||
context->use_tmp_dh_file("../../src/ssl/dh512.pem");
|
||||
} catch (std::exception& e) {
|
||||
std::cout << e.what() << std::endl;
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
void validate(connection_ptr connection) {
|
||||
//std::cout << "state: " << connection->get_state() << std::endl;
|
||||
}
|
||||
|
||||
void on_open(connection_ptr connection) {
|
||||
//std::cout << "connection opened" << std::endl;
|
||||
m_connections.insert(connection);
|
||||
}
|
||||
|
||||
void on_close(connection_ptr connection) {
|
||||
//std::cout << "connection closed" << std::endl;
|
||||
m_connections.erase(connection);
|
||||
}
|
||||
|
||||
void on_message(connection_ptr connection,websocketpp::message::data_ptr msg) {
|
||||
typename std::set<connection_ptr>::iterator it;
|
||||
|
||||
for (it = m_connections.begin(); it != m_connections.end(); it++) {
|
||||
(*it)->send(msg->get_payload(),(msg->get_opcode() == websocketpp::frame::opcode::BINARY));
|
||||
}
|
||||
|
||||
connection->recycle(msg);
|
||||
}
|
||||
|
||||
void http(connection_ptr connection) {
|
||||
std::stringstream foo;
|
||||
|
||||
foo << "<html><body><p>" << m_connections.size() << " current connections.</p></body></html>";
|
||||
|
||||
connection->set_body(foo.str());
|
||||
}
|
||||
|
||||
void on_fail(connection_ptr connection) {
|
||||
std::cout << "connection failed" << std::endl;
|
||||
}
|
||||
private:
|
||||
std::set<connection_ptr> m_connections;
|
||||
};
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
unsigned short port = 9002;
|
||||
bool tls = false;
|
||||
|
||||
if (argc == 2) {
|
||||
// TODO: input validation?
|
||||
port = atoi(argv[1]);
|
||||
}
|
||||
|
||||
if (argc == 3) {
|
||||
// TODO: input validation?
|
||||
port = atoi(argv[1]);
|
||||
tls = !strcmp(argv[2],"-tls");
|
||||
}
|
||||
|
||||
try {
|
||||
if (tls) {
|
||||
tls_handler_ptr h(new broadcast_server_handler<tls_endpoint_type>());
|
||||
tls_endpoint_type e(h);
|
||||
|
||||
e.alog().unset_level(websocketpp::log::alevel::ALL);
|
||||
e.elog().set_level(websocketpp::log::elevel::ALL);
|
||||
|
||||
std::cout << "Starting Secure WebSocket broadcast server on port " << port << std::endl;
|
||||
e.listen(port);
|
||||
} else {
|
||||
plain_handler_ptr h(new broadcast_server_handler<plain_endpoint_type>());
|
||||
plain_endpoint_type e(h);
|
||||
|
||||
e.alog().unset_level(websocketpp::log::alevel::ALL);
|
||||
e.elog().set_level(websocketpp::log::elevel::ALL);
|
||||
|
||||
std::cout << "Starting WebSocket broadcast server on port " << port << std::endl;
|
||||
e.listen(port);
|
||||
}
|
||||
} catch (std::string e) {
|
||||
//std::cerr << "Exception: " << e.what() << std::endl;
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
23
examples/stress_client/Makefile
Normal file
23
examples/stress_client/Makefile
Normal file
@@ -0,0 +1,23 @@
|
||||
CFLAGS = -O2
|
||||
LDFLAGS =
|
||||
|
||||
CXX ?= c++
|
||||
SHARED ?= "1"
|
||||
|
||||
ifeq ($(SHARED), 1)
|
||||
LDFLAGS := $(LDFLAGS) -lboost_system -lboost_thread -lwebsocketpp
|
||||
else
|
||||
LDFLAGS := $(LDFLAGS) -lboost_system -lboost_thread -lboost_date_time -lboost_regex -lboost_random -lboost_program_options ../../libwebsocketpp.a
|
||||
endif
|
||||
|
||||
stress_client: stress_client.o
|
||||
$(CXX) $(CFLAGS) $^ -o $@ $(LDFLAGS)
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) -c $(CFLAGS) -o $@ $^
|
||||
|
||||
# cleanup by removing generated files
|
||||
#
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f *.o stress_client
|
||||
BIN
examples/stress_client/stress_client
Executable file
BIN
examples/stress_client/stress_client
Executable file
Binary file not shown.
124
examples/stress_client/stress_client.cpp
Normal file
124
examples/stress_client/stress_client.cpp
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Peter Thorson. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the WebSocket++ Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../src/endpoint.hpp"
|
||||
#include "../../src/roles/client.hpp"
|
||||
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
typedef websocketpp::endpoint<websocketpp::role::client,websocketpp::socket::plain> plain_endpoint_type;
|
||||
typedef plain_endpoint_type::handler_ptr plain_handler_ptr;
|
||||
typedef plain_endpoint_type::connection_ptr connection_ptr;
|
||||
|
||||
class echo_client_handler : public plain_endpoint_type::handler {
|
||||
public:
|
||||
typedef echo_client_handler type;
|
||||
typedef plain_endpoint_type::connection_ptr connection_ptr;
|
||||
|
||||
void on_message(connection_ptr connection,websocketpp::message::data_ptr msg) {
|
||||
/*if (connection->get_resource() == "/getCaseCount") {
|
||||
std::cout << "Detected " << msg->get_payload() << " test cases." << std::endl;
|
||||
m_case_count = atoi(msg->get_payload().c_str());
|
||||
} else {
|
||||
connection->send(msg->get_payload(),(msg->get_opcode() == websocketpp::frame::opcode::BINARY));
|
||||
}*/
|
||||
|
||||
connection->recycle(msg);
|
||||
}
|
||||
|
||||
void http(connection_ptr connection) {
|
||||
//connection->set_body("HTTP Response!!");
|
||||
}
|
||||
|
||||
void on_fail(connection_ptr connection) {
|
||||
std::cout << "connection failed" << std::endl;
|
||||
}
|
||||
|
||||
int m_case_count;
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
std::string uri;
|
||||
|
||||
/*if (argc != 2) {
|
||||
std::cout << "Usage: `echo_client test_url`" << std::endl;
|
||||
} else {
|
||||
uri = argv[1];
|
||||
}*/
|
||||
|
||||
int num_connections = 500;
|
||||
|
||||
if (argc == 2) {
|
||||
// TODO: input validation?
|
||||
num_connections = atoi(argv[1]);
|
||||
}
|
||||
|
||||
try {
|
||||
plain_handler_ptr handler(new echo_client_handler());
|
||||
plain_endpoint_type endpoint(handler);
|
||||
|
||||
endpoint.alog().unset_level(websocketpp::log::alevel::ALL);
|
||||
endpoint.elog().set_level(websocketpp::log::elevel::ALL);
|
||||
|
||||
std::set<connection_ptr> connections;
|
||||
|
||||
|
||||
connections.insert(endpoint.connect("ws://localhost:9002/"));
|
||||
|
||||
//boost::thread t(boost::bind(&plain_endpoint_type::run, &endpoint));
|
||||
|
||||
std::cout << "launching connections" << std::endl;
|
||||
|
||||
for (int i = 0; i < num_connections; i++) {
|
||||
connections.insert(endpoint.connect("ws://localhost:9002/"));
|
||||
}
|
||||
|
||||
std::cout << "complete" << std::endl;
|
||||
|
||||
endpoint.run();
|
||||
|
||||
/*char line[512];
|
||||
while (std::cin.getline(line, 512)) {
|
||||
std::iterator
|
||||
|
||||
c->send(line);
|
||||
}*/
|
||||
|
||||
//t.join();
|
||||
|
||||
|
||||
std::cout << "done" << std::endl;
|
||||
|
||||
} catch (std::exception& e) {
|
||||
std::cerr << "Exception: " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -44,6 +44,18 @@ using boost::asio::ip::tcp;
|
||||
namespace websocketpp {
|
||||
namespace role {
|
||||
|
||||
/*class client_exception : public std::exception {
|
||||
public:
|
||||
client_exception(const std::string& msg) : m_msg(msg {}
|
||||
~client_exception() throw() {}
|
||||
|
||||
virtual const char* what() const throw() {
|
||||
return m_msg.c_str();
|
||||
}
|
||||
|
||||
std::string m_msg;
|
||||
};*/
|
||||
|
||||
template <class endpoint>
|
||||
class client {
|
||||
public:
|
||||
@@ -254,12 +266,32 @@ void client<endpoint>::handle_connect(connection_ptr con,
|
||||
m_state = CONNECTED;
|
||||
con->start();
|
||||
} else {
|
||||
m_endpoint.elog().at(log::elevel::ERROR)
|
||||
<< "An error occurred while establishing a connection: "
|
||||
<< error << log::endl;
|
||||
|
||||
// TODO: fix
|
||||
throw "client error";
|
||||
if (error == boost::system::errc::connection_refused) {
|
||||
m_endpoint.elog().at(log::elevel::ERROR)
|
||||
<< "An error occurred while establishing a connection: "
|
||||
<< error << " (connection refused)" << log::endl;
|
||||
} else if (error == boost::system::errc::operation_canceled) {
|
||||
m_endpoint.elog().at(log::elevel::ERROR)
|
||||
<< "An error occurred while establishing a connection: "
|
||||
<< error << " (operation canceled)" << log::endl;
|
||||
} else if (error == boost::system::errc::connection_reset) {
|
||||
m_endpoint.elog().at(log::elevel::ERROR)
|
||||
<< "An error occurred while establishing a connection: "
|
||||
<< error << " (connection reset)" << log::endl;
|
||||
} else if (error == boost::system::errc::timed_out) {
|
||||
m_endpoint.elog().at(log::elevel::ERROR)
|
||||
<< "An error occurred while establishing a connection: "
|
||||
<< error << " (operation timed out)" << log::endl;
|
||||
} else if (error == boost::system::errc::broken_pipe) {
|
||||
m_endpoint.elog().at(log::elevel::ERROR)
|
||||
<< "An error occurred while establishing a connection: "
|
||||
<< error << " (broken pipe)" << log::endl;
|
||||
}else {
|
||||
m_endpoint.elog().at(log::elevel::ERROR)
|
||||
<< "An error occurred while establishing a connection: "
|
||||
<< error << " (unknown)" << log::endl;
|
||||
throw "client error";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +349,9 @@ void client<endpoint>::connection<connection_type>::handle_write_request(
|
||||
const boost::system::error_code& error)
|
||||
{
|
||||
if (error) {
|
||||
m_endpoint.elog().at(log::elevel::ERROR) << "Error writing WebSocket request. code: " << error << log::endl;
|
||||
|
||||
|
||||
m_endpoint.elog().at(log::elevel::ERROR) << "Error writing WebSocket request. code: " << error << log::endl;
|
||||
m_connection.terminate(false);
|
||||
return;
|
||||
|
||||
|
||||
@@ -231,7 +231,15 @@ void server<endpoint>::handle_accept(connection_ptr con,
|
||||
const boost::system::error_code& error)
|
||||
{
|
||||
if (error) {
|
||||
m_ws_endpoint.elog().at(log::elevel::ERROR) << "async_accept returned error: " << error << log::endl;
|
||||
if (error == boost::system::errc::too_many_files_open) {
|
||||
m_ws_endpoint.elog().at(log::elevel::ERROR)
|
||||
<< "async_accept returned error: " << error
|
||||
<< " (too many files open)" << log::endl;
|
||||
} else {
|
||||
m_ws_endpoint.elog().at(log::elevel::ERROR)
|
||||
<< "async_accept returned error: " << error
|
||||
<< " (unknown)" << log::endl;
|
||||
}
|
||||
} else {
|
||||
con->start();
|
||||
}
|
||||
@@ -502,8 +510,21 @@ void server<endpoint>::connection<connection_type>::log_open_result() {
|
||||
std::stringstream version;
|
||||
version << "v" << m_version << " ";
|
||||
|
||||
std::string remote;
|
||||
boost::system::error_code ec;
|
||||
boost::asio::ip::tcp::endpoint ep = m_connection.get_raw_socket().remote_endpoint(ec);
|
||||
if (ec) {
|
||||
// An error occurred.
|
||||
//remote = "Unknown";
|
||||
//ignore?
|
||||
m_endpoint.elog().at(log::elevel::WARN) << "Error getting remote endpoint. code: " << ec << log::endl;
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
|
||||
m_endpoint.alog().at(log::alevel::CONNECT) << (m_version == -1 ? "HTTP" : "WebSocket") << " Connection "
|
||||
<< m_connection.get_raw_socket().remote_endpoint() << " "
|
||||
<< ep << " "
|
||||
<< (m_version == -1 ? "" : version.str())
|
||||
<< (get_request_header("User-Agent") == "" ? "NULL" : get_request_header("User-Agent"))
|
||||
<< " " << m_uri->get_resource() << " " << m_response.get_status_code()
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
|
||||
void async_init(socket_init_callback callback) {
|
||||
// TODO: should this use post()?
|
||||
m_socket.set_option(boost::asio::ip::tcp::no_delay(true));
|
||||
//m_socket.set_option(boost::asio::ip::tcp::no_delay(true));
|
||||
|
||||
callback(boost::system::error_code());
|
||||
}
|
||||
|
||||
@@ -44,6 +44,20 @@
|
||||
B673247E148FB13900FC2B04 /* libboost_random.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B682888C1437464A002BA48B /* libboost_random.dylib */; };
|
||||
B673247F148FB13900FC2B04 /* libboost_regex.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6DF1CBF1434AF6A0029A1B1 /* libboost_regex.dylib */; };
|
||||
B6732480148FB13900FC2B04 /* libboost_system.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6DF1CBC1434AE070029A1B1 /* libboost_system.dylib */; };
|
||||
B67324931491A18100FC2B04 /* broadcast_server_tls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B673248314919D6600FC2B04 /* broadcast_server_tls.cpp */; };
|
||||
B67324941491A18500FC2B04 /* libwebsocketpp.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6DF1C721434A8280029A1B1 /* libwebsocketpp.dylib */; };
|
||||
B67324951491A19700FC2B04 /* libboost_date_time.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6DF1CBE1434AF6A0029A1B1 /* libboost_date_time.dylib */; };
|
||||
B67324961491A19700FC2B04 /* libboost_regex.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6DF1CBF1434AF6A0029A1B1 /* libboost_regex.dylib */; };
|
||||
B67324971491A19700FC2B04 /* libboost_system.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6DF1CBC1434AE070029A1B1 /* libboost_system.dylib */; };
|
||||
B67324981491A1A700FC2B04 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6FE8D5B14730B1A00B32547 /* libcrypto.dylib */; };
|
||||
B67324991491A1AE00FC2B04 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6FE8D5D14730B2200B32547 /* libssl.dylib */; };
|
||||
B67324AC1491A80400FC2B04 /* stress_client.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B673249D1491A51E00FC2B04 /* stress_client.cpp */; };
|
||||
B67324AD1491A80800FC2B04 /* libwebsocketpp.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6DF1C721434A8280029A1B1 /* libwebsocketpp.dylib */; };
|
||||
B67324AE1491A81600FC2B04 /* libboost_date_time.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6DF1CBE1434AF6A0029A1B1 /* libboost_date_time.dylib */; };
|
||||
B67324AF1491A81600FC2B04 /* libboost_random.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B682888C1437464A002BA48B /* libboost_random.dylib */; };
|
||||
B67324B01491A81600FC2B04 /* libboost_regex.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6DF1CBF1434AF6A0029A1B1 /* libboost_regex.dylib */; };
|
||||
B67324B11491A81600FC2B04 /* libboost_system.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6DF1CBC1434AE070029A1B1 /* libboost_system.dylib */; };
|
||||
B67324B21491A84000FC2B04 /* libboost_thread.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B682888E14374689002BA48B /* libboost_thread.dylib */; };
|
||||
B68288871437460E002BA48B /* chat_client_handler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6828875143745DA002BA48B /* chat_client_handler.cpp */; };
|
||||
B68288881437460E002BA48B /* chat_client.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6828877143745DA002BA48B /* chat_client.cpp */; };
|
||||
B682888914374617002BA48B /* libwebsocketpp.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6DF1C721434A8280029A1B1 /* libwebsocketpp.dylib */; };
|
||||
@@ -129,6 +143,24 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
B67324871491A16500FC2B04 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
B67324A01491A7F100FC2B04 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
B682887B143745F2002BA48B /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -229,6 +261,13 @@
|
||||
B673246B148FB0C400FC2B04 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
|
||||
B673246C148FB0F000FC2B04 /* fuzzing_client.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = fuzzing_client.cpp; sourceTree = "<group>"; };
|
||||
B6732471148FB0FC00FC2B04 /* fuzzing_client */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fuzzing_client; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
B673248214919D6600FC2B04 /* broadcast_admin.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = broadcast_admin.html; sourceTree = "<group>"; };
|
||||
B673248314919D6600FC2B04 /* broadcast_server_tls.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = broadcast_server_tls.cpp; sourceTree = "<group>"; };
|
||||
B673248414919D6600FC2B04 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
|
||||
B67324891491A16500FC2B04 /* broadcast_server */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = broadcast_server; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
B673249C1491A50000FC2B04 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
|
||||
B673249D1491A51E00FC2B04 /* stress_client.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = stress_client.cpp; sourceTree = "<group>"; };
|
||||
B67324A21491A7F100FC2B04 /* stress_client */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = stress_client; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
B6828875143745DA002BA48B /* chat_client_handler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = chat_client_handler.cpp; path = examples/chat_client/chat_client_handler.cpp; sourceTree = "<group>"; };
|
||||
B6828876143745DA002BA48B /* chat_client_handler.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = chat_client_handler.hpp; path = examples/chat_client/chat_client_handler.hpp; sourceTree = "<group>"; };
|
||||
B6828877143745DA002BA48B /* chat_client.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = chat_client.cpp; path = examples/chat_client/chat_client.cpp; sourceTree = "<group>"; };
|
||||
@@ -311,6 +350,32 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
B67324861491A16500FC2B04 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B67324991491A1AE00FC2B04 /* libssl.dylib in Frameworks */,
|
||||
B67324981491A1A700FC2B04 /* libcrypto.dylib in Frameworks */,
|
||||
B67324951491A19700FC2B04 /* libboost_date_time.dylib in Frameworks */,
|
||||
B67324961491A19700FC2B04 /* libboost_regex.dylib in Frameworks */,
|
||||
B67324971491A19700FC2B04 /* libboost_system.dylib in Frameworks */,
|
||||
B67324941491A18500FC2B04 /* libwebsocketpp.dylib in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
B673249F1491A7F100FC2B04 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B67324B21491A84000FC2B04 /* libboost_thread.dylib in Frameworks */,
|
||||
B67324AE1491A81600FC2B04 /* libboost_date_time.dylib in Frameworks */,
|
||||
B67324AF1491A81600FC2B04 /* libboost_random.dylib in Frameworks */,
|
||||
B67324B01491A81600FC2B04 /* libboost_regex.dylib in Frameworks */,
|
||||
B67324B11491A81600FC2B04 /* libboost_system.dylib in Frameworks */,
|
||||
B67324AD1491A80800FC2B04 /* libwebsocketpp.dylib in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
B682887A143745F2002BA48B /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -496,6 +561,27 @@
|
||||
path = examples/fuzzing_client;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B673248114919D6600FC2B04 /* broadcast_server_tls */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B673248214919D6600FC2B04 /* broadcast_admin.html */,
|
||||
B673248314919D6600FC2B04 /* broadcast_server_tls.cpp */,
|
||||
B673248414919D6600FC2B04 /* Makefile */,
|
||||
);
|
||||
name = broadcast_server_tls;
|
||||
path = examples/broadcast_server_tls;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B673249A1491A50000FC2B04 /* stress_client */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B673249D1491A51E00FC2B04 /* stress_client.cpp */,
|
||||
B673249C1491A50000FC2B04 /* Makefile */,
|
||||
);
|
||||
name = stress_client;
|
||||
path = examples/stress_client;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B6CF18121437C370009295BE /* echo_client */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -540,6 +626,8 @@
|
||||
B663884B1487D73200DDAE13 /* echo_server_tls */,
|
||||
B6732458148FAEEB00FC2B04 /* fuzzing_server */,
|
||||
B6732471148FB0FC00FC2B04 /* fuzzing_client */,
|
||||
B67324891491A16500FC2B04 /* broadcast_server */,
|
||||
B67324A21491A7F100FC2B04 /* stress_client */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -615,6 +703,8 @@
|
||||
B6DF1CC61435ED380029A1B1 /* examples */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B673249A1491A50000FC2B04 /* stress_client */,
|
||||
B673248114919D6600FC2B04 /* broadcast_server_tls */,
|
||||
B6732469148FB0C400FC2B04 /* fuzzing_client */,
|
||||
B673244F148F973D00FC2B04 /* fuzzing_server_tls */,
|
||||
B6CF18121437C370009295BE /* echo_client */,
|
||||
@@ -780,6 +870,40 @@
|
||||
productReference = B6732471148FB0FC00FC2B04 /* fuzzing_client */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
B67324881491A16500FC2B04 /* broadcast_server */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = B67324901491A16500FC2B04 /* Build configuration list for PBXNativeTarget "broadcast_server" */;
|
||||
buildPhases = (
|
||||
B67324851491A16500FC2B04 /* Sources */,
|
||||
B67324861491A16500FC2B04 /* Frameworks */,
|
||||
B67324871491A16500FC2B04 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = broadcast_server;
|
||||
productName = broadcast_server;
|
||||
productReference = B67324891491A16500FC2B04 /* broadcast_server */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
B67324A11491A7F100FC2B04 /* stress_client */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = B67324A91491A7F200FC2B04 /* Build configuration list for PBXNativeTarget "stress_client" */;
|
||||
buildPhases = (
|
||||
B673249E1491A7F100FC2B04 /* Sources */,
|
||||
B673249F1491A7F100FC2B04 /* Frameworks */,
|
||||
B67324A01491A7F100FC2B04 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = stress_client;
|
||||
productName = stress_client;
|
||||
productReference = B67324A21491A7F100FC2B04 /* stress_client */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
B682887C143745F2002BA48B /* chat_client */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = B6828884143745F2002BA48B /* Build configuration list for PBXNativeTarget "chat_client" */;
|
||||
@@ -913,6 +1037,8 @@
|
||||
B663884A1487D73200DDAE13 /* echo_server_tls */,
|
||||
B6732457148FAEEB00FC2B04 /* fuzzing_server */,
|
||||
B6732470148FB0FC00FC2B04 /* fuzzing_client */,
|
||||
B67324881491A16500FC2B04 /* broadcast_server */,
|
||||
B67324A11491A7F100FC2B04 /* stress_client */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@@ -942,6 +1068,22 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
B67324851491A16500FC2B04 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B67324931491A18100FC2B04 /* broadcast_server_tls.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
B673249E1491A7F100FC2B04 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B67324AC1491A80400FC2B04 /* stress_client.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
B6828879143745F2002BA48B /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -1131,6 +1273,82 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
B67324911491A16500FC2B04 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
B67324921491A16500FC2B04 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
B67324AA1491A7F200FC2B04 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
B67324AB1491A7F200FC2B04 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
B6828885143745F2002BA48B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
@@ -1422,6 +1640,22 @@
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
};
|
||||
B67324901491A16500FC2B04 /* Build configuration list for PBXNativeTarget "broadcast_server" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
B67324911491A16500FC2B04 /* Debug */,
|
||||
B67324921491A16500FC2B04 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
};
|
||||
B67324A91491A7F200FC2B04 /* Build configuration list for PBXNativeTarget "stress_client" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
B67324AA1491A7F200FC2B04 /* Debug */,
|
||||
B67324AB1491A7F200FC2B04 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
};
|
||||
B6828884143745F2002BA48B /* Build configuration list for PBXNativeTarget "chat_client" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
||||
Reference in New Issue
Block a user