mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 15:00:30 +01:00
Don't build debug strings when debug is not enabled.
This commit is contained in:
parent
0a263b0ac9
commit
e5e49dc5bd
1 changed files with 17 additions and 12 deletions
|
@ -98,7 +98,8 @@ public abstract class NetworkNode implements MessageListener {
|
|||
|
||||
public SettableFuture<Connection> sendMessage(@NotNull NodeAddress peersNodeAddress,
|
||||
NetworkEnvelope networkEnvelope) {
|
||||
log.debug("sendMessage: peersNodeAddress=" + peersNodeAddress + "\n\tmessage=" + Utilities.toTruncatedString(networkEnvelope));
|
||||
if (log.isDebugEnabled())
|
||||
log.debug("sendMessage: peersNodeAddress=" + peersNodeAddress + "\n\tmessage=" + Utilities.toTruncatedString(networkEnvelope));
|
||||
checkNotNull(peersNodeAddress, "peerAddress must not be null");
|
||||
|
||||
Connection connection = getOutboundConnection(peersNodeAddress);
|
||||
|
@ -123,11 +124,13 @@ public abstract class NetworkNode implements MessageListener {
|
|||
try {
|
||||
// can take a while when using tor
|
||||
long startTs = System.currentTimeMillis();
|
||||
log.debug("Start create socket to peersNodeAddress {}", peersNodeAddress.getFullAddress());
|
||||
if (log.isDebugEnabled())
|
||||
log.debug("Start create socket to peersNodeAddress {}", peersNodeAddress.getFullAddress());
|
||||
Socket socket = createSocket(peersNodeAddress);
|
||||
long duration = System.currentTimeMillis() - startTs;
|
||||
log.debug("Socket creation to peersNodeAddress {} took {} ms", peersNodeAddress.getFullAddress(),
|
||||
duration);
|
||||
if (log.isDebugEnabled())
|
||||
log.debug("Socket creation to peersNodeAddress {} took {} ms", peersNodeAddress.getFullAddress(),
|
||||
duration);
|
||||
|
||||
if (duration > CREATE_SOCKET_TIMEOUT)
|
||||
throw new TimeoutException("A timeout occurred when creating a socket.");
|
||||
|
@ -139,7 +142,8 @@ public abstract class NetworkNode implements MessageListener {
|
|||
existingConnection = getOutboundConnection(peersNodeAddress);
|
||||
|
||||
if (existingConnection != null) {
|
||||
log.debug("We found in the meantime a connection for peersNodeAddress {}, " +
|
||||
if (log.isDebugEnabled())
|
||||
log.debug("We found in the meantime a connection for peersNodeAddress {}, " +
|
||||
"so we use that for sending the message.\n" +
|
||||
"That can happen if Tor needs long for creating a new outbound connection.\n" +
|
||||
"We might have got a new inbound or outbound connection.",
|
||||
|
@ -184,13 +188,14 @@ public abstract class NetworkNode implements MessageListener {
|
|||
peersNodeAddress,
|
||||
networkProtoResolver);
|
||||
|
||||
log.debug("\n\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n" +
|
||||
"NetworkNode created new outbound connection:"
|
||||
+ "\nmyNodeAddress=" + getNodeAddress()
|
||||
+ "\npeersNodeAddress=" + peersNodeAddress
|
||||
+ "\nuid=" + outboundConnection.getUid()
|
||||
+ "\nmessage=" + networkEnvelope
|
||||
+ "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n");
|
||||
if (log.isDebugEnabled())
|
||||
log.debug("\n\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n" +
|
||||
"NetworkNode created new outbound connection:"
|
||||
+ "\nmyNodeAddress=" + getNodeAddress()
|
||||
+ "\npeersNodeAddress=" + peersNodeAddress
|
||||
+ "\nuid=" + outboundConnection.getUid()
|
||||
+ "\nmessage=" + networkEnvelope
|
||||
+ "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n");
|
||||
|
||||
// can take a while when using tor
|
||||
outboundConnection.sendMessage(networkEnvelope);
|
||||
|
|
Loading…
Add table
Reference in a new issue