|
|
@ -12,21 +12,26 @@ namespace Stratum |
|
|
|
{ |
|
|
|
{ |
|
|
|
bool Client::Start() |
|
|
|
bool Client::Start() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Get IP
|
|
|
|
try { |
|
|
|
tcp::endpoint remote_ep = _socket.remote_endpoint(); |
|
|
|
// Get IP
|
|
|
|
address remote_ad = remote_ep.address(); |
|
|
|
tcp::endpoint remote_ep = _socket.remote_endpoint(); |
|
|
|
_ip = remote_ad.to_v4().to_ulong(); |
|
|
|
address remote_ad = remote_ep.address(); |
|
|
|
|
|
|
|
_ip = remote_ad.to_v4().to_ulong(); |
|
|
|
if (_server->IsBanned(_ip)) { |
|
|
|
|
|
|
|
sLog.Warn(LOG_STRATUM, "Blocked banned client from: %s", remote_ad.to_v4().to_string().c_str()); |
|
|
|
if (_server->IsBanned(_ip)) { |
|
|
|
Disconnect(); |
|
|
|
sLog.Warn(LOG_STRATUM, "Blocked banned client from: %s", remote_ad.to_v4().to_string().c_str()); |
|
|
|
return false; |
|
|
|
Disconnect(); |
|
|
|
} |
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
// Start reading socket
|
|
|
|
|
|
|
|
StartRead(); |
|
|
|
// Start reading socket
|
|
|
|
|
|
|
|
StartRead(); |
|
|
|
return true; |
|
|
|
} catch (std::exception& e) { |
|
|
|
|
|
|
|
sLog.Error(LOG_SERVER, "Exception caught while accepting client: %s", e.what()); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Client::SendJob(bool clean) |
|
|
|
void Client::SendJob(bool clean) |
|
|
|