Merge pull request #1048 from diath/fix_static_linkage

Fix an issue with Connection class linkage
This commit is contained in:
Konrad Kuśnierz 2019-10-14 08:09:54 +02:00 committed by GitHub
commit 0b0c8191dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 9 deletions

View File

@ -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<uint32>(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<asio::ip::tcp>::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<uint32>(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<uint32>(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<uint32>(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<uint32>(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<uint32>(READ_TIMEOUT)));
m_readTimer.async_wait(std::bind(&Connection::onTimeout, asConnection(), std::placeholders::_1));
}

View File

@ -33,10 +33,9 @@ class Connection : public LuaObject
typedef std::function<void(const boost::system::error_code&)> ErrorCallback;
typedef std::function<void(uint8*, uint16)> 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
};