Add getIp function, remove unused sql function

This commit is contained in:
Henrique Santiago
2012-08-12 01:54:45 -03:00
parent 8753f82fd0
commit 7fb2f6deb5
5 changed files with 12 additions and 21 deletions

View File

@@ -240,3 +240,13 @@ void Connection::handleError(const boost::system::error_code& error)
}
}
int Connection::getIp()
{
boost::system::error_code error;
const boost::asio::ip::tcp::endpoint ip = m_socket.remote_endpoint(error);
if(!error)
return boost::asio::detail::socket_ops::host_to_network_long(ip.address().to_v4().to_ulong());
g_logger.error("Getting remote ip");
return 0;
}

View File

@@ -58,6 +58,7 @@ public:
void setErrorCallback(const ErrorCallback& errorCallback) { m_errorCallback = errorCallback; }
int getIp();
boost::system::error_code getError() { return m_error; }
bool isConnecting() { return m_connecting; }
bool isConnected() { return m_connected; }