mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Corrects more obscure shadowed variables cases
This commit is contained in:
@@ -142,13 +142,13 @@ private:
|
||||
|
||||
int main() {
|
||||
try {
|
||||
broadcast_server server;
|
||||
broadcast_server server_instance;
|
||||
|
||||
// Start a thread to run the processing loop
|
||||
thread t(bind(&broadcast_server::process_messages,&server));
|
||||
thread t(bind(&broadcast_server::process_messages,&server_instance));
|
||||
|
||||
// Run the asio loop with the main thread
|
||||
server.run(9002);
|
||||
server_instance.run(9002);
|
||||
|
||||
t.join();
|
||||
|
||||
|
||||
@@ -279,9 +279,9 @@ private:
|
||||
};
|
||||
public:
|
||||
|
||||
explicit connection(bool is_server, std::string const & ua, alog_type& alog,
|
||||
explicit connection(bool p_is_server, std::string const & ua, alog_type& alog,
|
||||
elog_type& elog, rng_type & rng)
|
||||
: transport_con_type(is_server,alog,elog)
|
||||
: transport_con_type(p_is_server, alog, elog)
|
||||
, m_handle_read_frame(lib::bind(
|
||||
&type::handle_read_frame,
|
||||
this,
|
||||
|
||||
@@ -87,21 +87,21 @@ public:
|
||||
|
||||
typedef lib::shared_ptr<connection_weak_ptr> hdl_type;
|
||||
|
||||
explicit endpoint(bool is_server)
|
||||
explicit endpoint(bool p_is_server)
|
||||
: m_alog(config::alog_level, &std::cout)
|
||||
, m_elog(config::elog_level, &std::cerr)
|
||||
, m_user_agent(::websocketpp::user_agent)
|
||||
, m_open_handshake_timeout_dur(config::timeout_open_handshake)
|
||||
, m_close_handshake_timeout_dur(config::timeout_close_handshake)
|
||||
, m_pong_timeout_dur(config::timeout_pong)
|
||||
, m_is_server(is_server)
|
||||
, m_is_server(p_is_server)
|
||||
{
|
||||
m_alog.set_channels(config::alog_level);
|
||||
m_elog.set_channels(config::elog_level);
|
||||
|
||||
m_alog.write(log::alevel::devel,"endpoint constructor");
|
||||
m_alog.write(log::alevel::devel, "endpoint constructor");
|
||||
|
||||
transport_type::init_logging(&m_alog,&m_elog);
|
||||
transport_type::init_logging(&m_alog, &m_elog);
|
||||
}
|
||||
|
||||
/// Returns the user agent string that this endpoint will use
|
||||
|
||||
@@ -216,9 +216,9 @@ namespace websocketpp {
|
||||
|
||||
class exception : public std::exception {
|
||||
public:
|
||||
exception(std::string const & msg,
|
||||
error::value code = error::general)
|
||||
: m_msg(msg),m_code(code) {}
|
||||
exception(std::string const & msg, error::value p_code = error::general)
|
||||
: m_msg(msg), m_code(p_code) {}
|
||||
|
||||
~exception() throw() {}
|
||||
|
||||
virtual char const * what() const throw() {
|
||||
|
||||
@@ -38,15 +38,15 @@ namespace http {
|
||||
namespace parser {
|
||||
|
||||
inline bool request::parse_complete(std::istream& s) {
|
||||
std::string request;
|
||||
std::string req;
|
||||
|
||||
// get status line
|
||||
std::getline(s, request);
|
||||
std::getline(s, req);
|
||||
|
||||
if (request[request.size()-1] == '\r') {
|
||||
request.erase(request.end()-1);
|
||||
if (req[req.size()-1] == '\r') {
|
||||
req.erase(req.end()-1);
|
||||
|
||||
std::stringstream ss(request);
|
||||
std::stringstream ss(req);
|
||||
std::string val;
|
||||
|
||||
ss >> val;
|
||||
@@ -133,12 +133,12 @@ inline size_t request::consume(const char *buf, size_t len) {
|
||||
|
||||
inline std::string request::raw() {
|
||||
// TODO: validation. Make sure all required fields have been set?
|
||||
std::stringstream raw;
|
||||
std::stringstream ret;
|
||||
|
||||
raw << m_method << " " << m_uri << " " << get_version() << "\r\n";
|
||||
raw << raw_headers() << "\r\n" << m_body;
|
||||
ret << m_method << " " << m_uri << " " << get_version() << "\r\n";
|
||||
ret << raw_headers() << "\r\n" << m_body;
|
||||
|
||||
return raw.str();
|
||||
return ret.str();
|
||||
}
|
||||
|
||||
inline void request::set_method(const std::string& method) {
|
||||
|
||||
@@ -172,15 +172,15 @@ inline size_t response::consume(std::istream & s) {
|
||||
|
||||
inline bool response::parse_complete(std::istream& s) {
|
||||
// parse a complete header (ie \r\n\r\n MUST be in the input stream)
|
||||
std::string response;
|
||||
std::string line;
|
||||
|
||||
// get status line
|
||||
std::getline(s, response);
|
||||
std::getline(s, line);
|
||||
|
||||
if (response[response.size()-1] == '\r') {
|
||||
response.erase(response.end()-1);
|
||||
if (line[line.size()-1] == '\r') {
|
||||
line.erase(line.end()-1);
|
||||
|
||||
std::stringstream ss(response);
|
||||
std::stringstream ss(line);
|
||||
std::string str_val;
|
||||
int int_val;
|
||||
char char_val[256];
|
||||
@@ -201,14 +201,14 @@ inline bool response::parse_complete(std::istream& s) {
|
||||
inline std::string response::raw() const {
|
||||
// TODO: validation. Make sure all required fields have been set?
|
||||
|
||||
std::stringstream raw;
|
||||
std::stringstream ret;
|
||||
|
||||
raw << get_version() << " " << m_status_code << " " << m_status_msg;
|
||||
raw << "\r\n" << raw_headers() << "\r\n";
|
||||
ret << get_version() << " " << m_status_code << " " << m_status_msg;
|
||||
ret << "\r\n" << raw_headers() << "\r\n";
|
||||
|
||||
raw << m_body;
|
||||
ret << m_body;
|
||||
|
||||
return raw.str();
|
||||
return ret.str();
|
||||
}
|
||||
|
||||
inline void response::set_status(status_code::value code) {
|
||||
|
||||
@@ -1630,7 +1630,7 @@ void connection<config>::handle_write_frame(lib::error_code const & ec)
|
||||
m_alog.write(log::alevel::devel,"connection handle_write_frame");
|
||||
}
|
||||
|
||||
bool terminate = m_current_msg->get_terminal();
|
||||
bool terminal = m_current_msg->get_terminal();
|
||||
|
||||
m_send_buffer.clear();
|
||||
m_current_msg.reset();
|
||||
@@ -1641,7 +1641,7 @@ void connection<config>::handle_write_frame(lib::error_code const & ec)
|
||||
return;
|
||||
}
|
||||
|
||||
if (terminate) {
|
||||
if (terminal) {
|
||||
this->terminate(lib::error_code());
|
||||
return;
|
||||
}
|
||||
@@ -1735,13 +1735,13 @@ void connection<config>::process_control_frame(typename config::message_type::pt
|
||||
}
|
||||
|
||||
if (op == frame::opcode::PING) {
|
||||
bool pong = true;
|
||||
bool should_reply = true;
|
||||
|
||||
if (m_ping_handler) {
|
||||
pong = m_ping_handler(m_connection_hdl, msg->get_payload());
|
||||
should_reply = m_ping_handler(m_connection_hdl, msg->get_payload());
|
||||
}
|
||||
|
||||
if (pong) {
|
||||
if (should_reply) {
|
||||
this->pong(msg->get_payload(),ec);
|
||||
if (ec) {
|
||||
m_elog.write(log::elevel::devel,
|
||||
@@ -1813,7 +1813,7 @@ void connection<config>::process_control_frame(typename config::message_type::pt
|
||||
}
|
||||
} else if (m_state == session::state::closing && !m_was_clean) {
|
||||
// ack of our close
|
||||
m_alog.write(log::alevel::devel,"Got acknowledgement of close");
|
||||
m_alog.write(log::alevel::devel, "Got acknowledgement of close");
|
||||
|
||||
m_was_clean = true;
|
||||
|
||||
@@ -1829,11 +1829,11 @@ void connection<config>::process_control_frame(typename config::message_type::pt
|
||||
}
|
||||
} else {
|
||||
// spurious, ignore
|
||||
m_elog.write(log::elevel::devel,"Got close frame in wrong state");
|
||||
m_elog.write(log::elevel::devel, "Got close frame in wrong state");
|
||||
}
|
||||
} else {
|
||||
// got an invalid control opcode
|
||||
m_elog.write(log::elevel::devel,"Got control frame with invalid opcode");
|
||||
m_elog.write(log::elevel::devel, "Got control frame with invalid opcode");
|
||||
// initiate protocol error shutdown
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +69,7 @@ public:
|
||||
|
||||
explicit server() : endpoint_type(true)
|
||||
{
|
||||
endpoint_type::m_alog.write(log::alevel::devel,
|
||||
"server constructor");
|
||||
endpoint_type::m_alog.write(log::alevel::devel, "server constructor");
|
||||
}
|
||||
|
||||
// return an initialized connection_ptr. Call start() on this object to
|
||||
|
||||
@@ -47,13 +47,13 @@ static uint16_t const uri_default_secure_port = 443;
|
||||
|
||||
class uri {
|
||||
public:
|
||||
explicit uri(std::string const & uri) : m_valid(false) {
|
||||
explicit uri(std::string const & uri_string) : m_valid(false) {
|
||||
std::string::const_iterator it;
|
||||
std::string::const_iterator temp;
|
||||
|
||||
int state = 0;
|
||||
|
||||
it = uri.begin();
|
||||
it = uri_string.begin();
|
||||
|
||||
if (std::equal(it,it+6,"wss://")) {
|
||||
m_secure = true;
|
||||
@@ -88,14 +88,14 @@ public:
|
||||
//temp = std::find(it,it2,']');
|
||||
|
||||
temp = it;
|
||||
while (temp != uri.end()) {
|
||||
while (temp != uri_string.end()) {
|
||||
if (*temp == ']') {
|
||||
break;
|
||||
}
|
||||
++temp;
|
||||
}
|
||||
|
||||
if (temp == uri.end()) {
|
||||
if (temp == uri_string.end()) {
|
||||
return;
|
||||
} else {
|
||||
// validate IPv6 literal parts
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
m_host.append(it,temp);
|
||||
}
|
||||
it = temp+1;
|
||||
if (it == uri.end()) {
|
||||
if (it == uri_string.end()) {
|
||||
state = 2;
|
||||
} else if (*it == '/') {
|
||||
state = 2;
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
// IPv4 or hostname
|
||||
// extract until : or /
|
||||
while (state == 0) {
|
||||
if (it == uri.end()) {
|
||||
if (it == uri_string.end()) {
|
||||
state = 2;
|
||||
break;
|
||||
} else if (*it == '/') {
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
// parse port
|
||||
std::string port = "";
|
||||
while (state == 1) {
|
||||
if (it == uri.end()) {
|
||||
if (it == uri_string.end()) {
|
||||
// state is not used after this point presently.
|
||||
// this should be re-enabled if it ever is needed in a future
|
||||
// refactoring
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
}
|
||||
|
||||
m_resource = "/";
|
||||
m_resource.append(it,uri.end());
|
||||
m_resource.append(it,uri_string.end());
|
||||
|
||||
|
||||
m_valid = true;
|
||||
|
||||
Reference in New Issue
Block a user