mirror of
https://github.com/edubart/otclient.git
synced 2025-10-16 04:24:54 +02:00
Add getIp function, remove unused sql function
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -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; }
|
||||
|
Reference in New Issue
Block a user