diff --git a/src/framework/net/connection.cpp b/src/framework/net/connection.cpp index db81fad8..ee37a3f7 100644 --- a/src/framework/net/connection.cpp +++ b/src/framework/net/connection.cpp @@ -101,7 +101,7 @@ void Connection::connect(const std::string& host, uint16 port, const std::functi m_resolver.async_resolve(query, std::bind(&Connection::onResolve, asConnection(), std::placeholders::_1, std::placeholders::_2)); m_readTimer.cancel(); - m_readTimer.expires_from_now(boost::posix_time::seconds(READ_TIMEOUT)); + m_readTimer.expires_from_now(boost::posix_time::seconds(static_cast(READ_TIMEOUT))); m_readTimer.async_wait(std::bind(&Connection::onTimeout, asConnection(), std::placeholders::_1)); } @@ -110,7 +110,7 @@ void Connection::internal_connect(asio::ip::basic_resolver::itera m_socket.async_connect(*endpointIterator, std::bind(&Connection::onConnect, asConnection(), std::placeholders::_1)); m_readTimer.cancel(); - m_readTimer.expires_from_now(boost::posix_time::seconds(READ_TIMEOUT)); + m_readTimer.expires_from_now(boost::posix_time::seconds(static_cast(READ_TIMEOUT))); m_readTimer.async_wait(std::bind(&Connection::onTimeout, asConnection(), std::placeholders::_1)); } @@ -150,7 +150,7 @@ void Connection::internal_write() std::bind(&Connection::onWrite, asConnection(), std::placeholders::_1, std::placeholders::_2, outputStream)); m_writeTimer.cancel(); - m_writeTimer.expires_from_now(boost::posix_time::seconds(WRITE_TIMEOUT)); + m_writeTimer.expires_from_now(boost::posix_time::seconds(static_cast(WRITE_TIMEOUT))); m_writeTimer.async_wait(std::bind(&Connection::onTimeout, asConnection(), std::placeholders::_1)); } @@ -166,7 +166,7 @@ void Connection::read(uint16 bytes, const RecvCallback& callback) std::bind(&Connection::onRecv, asConnection(), std::placeholders::_1, std::placeholders::_2)); m_readTimer.cancel(); - m_readTimer.expires_from_now(boost::posix_time::seconds(READ_TIMEOUT)); + m_readTimer.expires_from_now(boost::posix_time::seconds(static_cast(READ_TIMEOUT))); m_readTimer.async_wait(std::bind(&Connection::onTimeout, asConnection(), std::placeholders::_1)); } @@ -183,7 +183,7 @@ void Connection::read_until(const std::string& what, const RecvCallback& callbac std::bind(&Connection::onRecv, asConnection(), std::placeholders::_1, std::placeholders::_2)); m_readTimer.cancel(); - m_readTimer.expires_from_now(boost::posix_time::seconds(READ_TIMEOUT)); + m_readTimer.expires_from_now(boost::posix_time::seconds(static_cast(READ_TIMEOUT))); m_readTimer.async_wait(std::bind(&Connection::onTimeout, asConnection(), std::placeholders::_1)); } @@ -198,7 +198,7 @@ void Connection::read_some(const RecvCallback& callback) std::bind(&Connection::onRecv, asConnection(), std::placeholders::_1, std::placeholders::_2)); m_readTimer.cancel(); - m_readTimer.expires_from_now(boost::posix_time::seconds(READ_TIMEOUT)); + m_readTimer.expires_from_now(boost::posix_time::seconds(static_cast(READ_TIMEOUT))); m_readTimer.async_wait(std::bind(&Connection::onTimeout, asConnection(), std::placeholders::_1)); } diff --git a/src/framework/net/connection.h b/src/framework/net/connection.h index 93a701ee..b9e56181 100644 --- a/src/framework/net/connection.h +++ b/src/framework/net/connection.h @@ -33,10 +33,9 @@ class Connection : public LuaObject typedef std::function ErrorCallback; typedef std::function RecvCallback; - static constexpr int32_t READ_TIMEOUT = 30; - static constexpr int32_t WRITE_TIMEOUT = 30; - enum { + READ_TIMEOUT = 30, + WRITE_TIMEOUT = 30, SEND_BUFFER_SIZE = 65536, RECV_BUFFER_SIZE = 65536 };