Skip to content

Commit da2e42f

Browse files
authored
Merge pull request #750 from evoskuil/master
Set address_ on socket accept.
2 parents 839cd96 + 3365253 commit da2e42f

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

include/bitcoin/network/net/socket.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ class BCT_API socket
161161
/// Properties.
162162
/// -----------------------------------------------------------------------
163163

164-
/// TODO: this can be set to the binding for incoming sockets.
165-
/// Get the address of the outgoing endpoint passed via construct.
164+
/// Get the address of the outgoing endpoint passed via construct, or the
165+
/// resolved endpoint address for incoming connections.
166166
virtual const config::address& address() const NOEXCEPT;
167167

168168
/// Get the endpoint of the remote host. Established by connection

src/net/hosts.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,11 @@ inline void hosts::push(const std::string& line) NOEXCEPT
304304
}
305305
else if (settings_.blacklisted(item))
306306
{
307-
LOGF("Address blacklisted upon load [" << line << "].");
307+
LOGV("Address blacklisted upon load [" << line << "].");
308308
}
309309
else if (!settings_.whitelisted(item))
310310
{
311-
LOGF("Address not whitelisted upon load [" << line << "].");
311+
LOGV("Address not whitelisted upon load [" << line << "].");
312312
}
313313
else
314314
{

src/net/socket_connect.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ void socket::handle_accept(boost_code ec,
8383
}
8484

8585
endpoint_ = { std::get<asio::socket>(socket_).remote_endpoint(ec) };
86+
address_ = endpoint_;
8687

8788
if (ec)
8889
{

src/sessions/session_inbound.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,15 @@ void session_inbound::handle_accepted(const code& ec,
174174

175175
if (!whitelisted(socket->address()))
176176
{
177-
////LOGS("Dropping not whitelisted peer [" << socket->endpoint() << "].");
177+
LOGV("Dropping not whitelisted peer [" << socket->endpoint() << "].");
178178
socket->stop();
179179
start_accept(error::success, acceptor);
180180
return;
181181
}
182182

183183
if (blacklisted(socket->address()))
184184
{
185-
////LOGS("Dropping blacklisted peer [" << socket->endpoint() << "].");
185+
LOGV("Dropping blacklisted peer [" << socket->endpoint() << "].");
186186
socket->stop();
187187
start_accept(error::success, acceptor);
188188
return;

src/sessions/session_server.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ code session_server::do_accept(const config::authorities& binds,
138138
// Accept cycle.
139139
// ----------------------------------------------------------------------------
140140

141-
// Attempt to accept peers on each configured endpoint.
141+
// Attempt to accept clients on each configured endpoint.
142142
void session_server::start_accept(const code&,
143143
const acceptor::ptr& acceptor, bool secure) NOEXCEPT
144144
{
@@ -205,15 +205,15 @@ void session_server::handle_accepted(const code& ec, const socket::ptr& socket,
205205

206206
if (!whitelisted(socket->address()))
207207
{
208-
////LOGS("Dropping not whitelisted peer [" << socket->endpoint() << "].");
208+
LOGV("Dropping not whitelisted client [" << socket->endpoint() << "].");
209209
socket->stop();
210210
start_accept(error::success, acceptor, secure);
211211
return;
212212
}
213213

214214
if (blacklisted(socket->address()))
215215
{
216-
////LOGS("Dropping blacklisted peer [" << socket->endpoint() << "].");
216+
LOGV("Dropping blacklisted client [" << socket->endpoint() << "].");
217217
socket->stop();
218218
start_accept(error::success, acceptor, secure);
219219
return;

0 commit comments

Comments
 (0)