zaphoyd/websocketpp — Issue #60: Policy Refactor: Small issue. Client declares tcp resolver as a member but it is possbile to use a local one.
Author: megabyte1024
Created: 2012-02-01 18:52:13+00:00
State: open

Issue Description: Client declares tcp resolver as a member but it is possbile to use a local one. Result - a smaller client's memory footprint.
File: client.hpp
Fix:
--------------------------------------- cut here ---------------------------------------
client (boost::asio::io_service& m)
: m_endpoint(static_cast< endpoint_type& >(*this)),
m_io_service(m),
- m_resolver(m),
m_gen(m_rng,boost::random::uniform_int_distribution<>(INT32_MIN,
INT32_MAX)) {}
--------------------------------------- cut here ---------------------------------------
endpoint_type& m_endpoint;
boost::asio::io_service& m_io_service;
- tcp::resolver m_resolver;

boost::random::random_device m_rng;
boost::random::variate_generator<
--------------------------------------- cut here ---------------------------------------
throw websocketpp::exception("Endpoint doesn't support secure connections.",websocketpp::error::ENDPOINT_UNSECURE);
}

+	tcp::resolver resolver(m_io_service);
tcp::resolver::query query(location->get_host(),location->get_port_str());
- tcp::resolver::iterator iterator = m_resolver.resolve(query);
+ tcp::resolver::iterator iterator = resolver.resolve(query);

connection_ptr con = m_endpoint.create_connection();
--------------------------------------- cut here ---------------------------------------