|
|
@ -32,7 +32,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <boost/bind.hpp>
|
|
|
|
|
|
|
|
#include <boost/foreach.hpp>
|
|
|
|
#include <boost/foreach.hpp>
|
|
|
|
#include <boost/uuid/random_generator.hpp>
|
|
|
|
#include <boost/uuid/random_generator.hpp>
|
|
|
|
#include <boost/chrono.hpp>
|
|
|
|
#include <boost/chrono.hpp>
|
|
|
@ -210,15 +209,15 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|
|
|
socket().async_receive(boost::asio::buffer(buffer_),
|
|
|
|
socket().async_receive(boost::asio::buffer(buffer_),
|
|
|
|
boost::asio::socket_base::message_peek,
|
|
|
|
boost::asio::socket_base::message_peek,
|
|
|
|
strand_.wrap(
|
|
|
|
strand_.wrap(
|
|
|
|
boost::bind(&connection<t_protocol_handler>::handle_receive, self,
|
|
|
|
std::bind(&connection<t_protocol_handler>::handle_receive, self,
|
|
|
|
boost::asio::placeholders::error,
|
|
|
|
std::placeholders::_1,
|
|
|
|
boost::asio::placeholders::bytes_transferred)));
|
|
|
|
std::placeholders::_2)));
|
|
|
|
else
|
|
|
|
else
|
|
|
|
async_read_some(boost::asio::buffer(buffer_),
|
|
|
|
async_read_some(boost::asio::buffer(buffer_),
|
|
|
|
strand_.wrap(
|
|
|
|
strand_.wrap(
|
|
|
|
boost::bind(&connection<t_protocol_handler>::handle_read, self,
|
|
|
|
std::bind(&connection<t_protocol_handler>::handle_read, self,
|
|
|
|
boost::asio::placeholders::error,
|
|
|
|
std::placeholders::_1,
|
|
|
|
boost::asio::placeholders::bytes_transferred)));
|
|
|
|
std::placeholders::_2)));
|
|
|
|
#if !defined(_WIN32) || !defined(__i686)
|
|
|
|
#if !defined(_WIN32) || !defined(__i686)
|
|
|
|
// not supported before Windows7, too lazy for runtime check
|
|
|
|
// not supported before Windows7, too lazy for runtime check
|
|
|
|
// Just exclude for 32bit windows builds
|
|
|
|
// Just exclude for 32bit windows builds
|
|
|
@ -688,7 +687,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|
|
|
reset_timer(get_default_timeout(), false);
|
|
|
|
reset_timer(get_default_timeout(), false);
|
|
|
|
async_write(boost::asio::buffer(m_send_que.front().data(), size_now ) ,
|
|
|
|
async_write(boost::asio::buffer(m_send_que.front().data(), size_now ) ,
|
|
|
|
strand_.wrap(
|
|
|
|
strand_.wrap(
|
|
|
|
boost::bind(&connection<t_protocol_handler>::handle_write, self, _1, _2)
|
|
|
|
std::bind(&connection<t_protocol_handler>::handle_write, self, std::placeholders::_1, std::placeholders::_2)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
//_dbg3("(chunk): " << size_now);
|
|
|
|
//_dbg3("(chunk): " << size_now);
|
|
|
@ -892,7 +891,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|
|
|
CHECK_AND_ASSERT_MES( size_now == m_send_que.front().size(), void(), "Unexpected queue size");
|
|
|
|
CHECK_AND_ASSERT_MES( size_now == m_send_que.front().size(), void(), "Unexpected queue size");
|
|
|
|
async_write(boost::asio::buffer(m_send_que.front().data(), size_now) ,
|
|
|
|
async_write(boost::asio::buffer(m_send_que.front().data(), size_now) ,
|
|
|
|
strand_.wrap(
|
|
|
|
strand_.wrap(
|
|
|
|
boost::bind(&connection<t_protocol_handler>::handle_write, connection<t_protocol_handler>::shared_from_this(), _1, _2)
|
|
|
|
std::bind(&connection<t_protocol_handler>::handle_write, connection<t_protocol_handler>::shared_from_this(), std::placeholders::_1, std::placeholders::_2)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
//_dbg3("(normal)" << size_now);
|
|
|
|
//_dbg3("(normal)" << size_now);
|
|
|
@ -1402,7 +1401,7 @@ POP_WARNINGS
|
|
|
|
shared_context->connect_mut.lock(); shared_context->ec = ec_; shared_context->cond.notify_one(); shared_context->connect_mut.unlock();
|
|
|
|
shared_context->connect_mut.lock(); shared_context->ec = ec_; shared_context->cond.notify_one(); shared_context->connect_mut.unlock();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
sock_.async_connect(remote_endpoint, boost::bind<void>(connect_callback, _1, local_shared_context));
|
|
|
|
sock_.async_connect(remote_endpoint, std::bind<void>(connect_callback, std::placeholders::_1, local_shared_context));
|
|
|
|
while(local_shared_context->ec == boost::asio::error::would_block)
|
|
|
|
while(local_shared_context->ec == boost::asio::error::would_block)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool r = local_shared_context->cond.timed_wait(lock, boost::get_system_time() + boost::posix_time::milliseconds(conn_timeout));
|
|
|
|
bool r = local_shared_context->cond.timed_wait(lock, boost::get_system_time() + boost::posix_time::milliseconds(conn_timeout));
|
|
|
|