fix compilation on win32

This commit is contained in:
Eduardo Bart
2012-04-13 21:14:25 -03:00
parent c4525059ce
commit cb7bd521d2
15 changed files with 309 additions and 130 deletions

View File

@@ -70,16 +70,16 @@ void Connection::connect(const std::string& host, uint16 port, const SimpleCallb
m_readTimer.cancel();
if(!error) {
m_socket.async_connect(*endpointIterator, std::bind(&Connection::onConnect, shared_from_this(), _1));
m_socket.async_connect(*endpointIterator, std::bind(&Connection::onConnect, shared_from_this(), std::placeholders::_1));
m_readTimer.expires_from_now(boost::posix_time::seconds(READ_TIMEOUT));
m_readTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), _1));
m_readTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), std::placeholders::_1));
} else
handleError(error);
});
m_readTimer.expires_from_now(boost::posix_time::seconds(READ_TIMEOUT));
m_readTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), _1));
m_readTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), std::placeholders::_1));
}
void Connection::close()
@@ -132,10 +132,10 @@ void Connection::write(uint8* buffer, uint16 size)
asio::async_write(m_socket,
asio::buffer(m_sendBuffer, m_sendBufferSize),
std::bind(&Connection::onWrite, shared_from_this(), _1, _2));
std::bind(&Connection::onWrite, shared_from_this(), std::placeholders::_1, std::placeholders::_2));
m_writeTimer.expires_from_now(boost::posix_time::seconds(WRITE_TIMEOUT));
m_writeTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), _1));
m_writeTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), std::placeholders::_1));
m_sendBufferSize = 0;
}, SEND_INTERVAL);
@@ -153,10 +153,10 @@ void Connection::read(uint16 bytes, const RecvCallback& callback)
asio::async_read(m_socket,
asio::buffer(m_recvBuffer, bytes),
std::bind(&Connection::onRecv, shared_from_this(), _1, bytes));
std::bind(&Connection::onRecv, shared_from_this(), std::placeholders::_1, bytes));
m_readTimer.expires_from_now(boost::posix_time::seconds(READ_TIMEOUT));
m_readTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), _1));
m_readTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), std::placeholders::_1));
}
void Connection::read_some(const RecvCallback& callback)
@@ -169,10 +169,10 @@ void Connection::read_some(const RecvCallback& callback)
m_recvCallback = callback;
m_socket.async_read_some(asio::buffer(m_recvBuffer, RECV_BUFFER_SIZE),
std::bind(&Connection::onRecv, shared_from_this(), _1, _2));
std::bind(&Connection::onRecv, shared_from_this(), std::placeholders::_1, std::placeholders::_2));
m_readTimer.expires_from_now(boost::posix_time::seconds(READ_TIMEOUT));
m_readTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), _1));
m_readTimer.async_wait(std::bind(&Connection::onTimeout, shared_from_this(), std::placeholders::_1));
}
void Connection::onConnect(const boost::system::error_code& error)

View File

@@ -37,7 +37,7 @@ Protocol::~Protocol()
void Protocol::connect(const std::string& host, uint16 port)
{
m_connection = ConnectionPtr(new Connection);
m_connection->setErrorCallback(std::bind(&Protocol::onError, asProtocol(), _1));
m_connection->setErrorCallback(std::bind(&Protocol::onError, asProtocol(), std::placeholders::_1));
m_connection->connect(host, port, std::bind(&Protocol::onConnect, asProtocol()));
}
@@ -89,7 +89,7 @@ void Protocol::recv()
m_inputMessage.reset();
if(m_connection)
m_connection->read(InputMessage::HEADER_LENGTH, std::bind(&Protocol::internalRecvHeader, asProtocol(), _1, _2));
m_connection->read(InputMessage::HEADER_LENGTH, std::bind(&Protocol::internalRecvHeader, asProtocol(), std::placeholders::_1, std::placeholders::_2));
}
void Protocol::internalRecvHeader(uint8* buffer, uint16 size)
@@ -102,7 +102,7 @@ void Protocol::internalRecvHeader(uint8* buffer, uint16 size)
// schedule read for message data
if(m_connection)
m_connection->read(dataSize, std::bind(&Protocol::internalRecvData, asProtocol(), _1, _2));
m_connection->read(dataSize, std::bind(&Protocol::internalRecvData, asProtocol(), std::placeholders::_1, std::placeholders::_2));
}
void Protocol::internalRecvData(uint8* buffer, uint16 size)