Skip to content

Commit

Permalink
Use logging instead of backtrace for IPv6-addresses when unsupported
Browse files Browse the repository at this point in the history
Throwing backtraces is needlessly expensive and spams the log with no
additional gain.
  • Loading branch information
ArneBab committed Apr 19, 2023
1 parent e3bb502 commit 0857c38
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/freenet/io/comm/UdpSocketHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.net.InetAddress;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.nio.channels.UnsupportedAddressTypeException;
import java.util.Random;

import freenet.io.AddressTracker;
Expand Down Expand Up @@ -338,7 +339,7 @@ public void sendPacket(byte[] blockToSend, Peer destination, boolean allowLocalA
boolean isLocal = (!IPUtil.isValidAddress(address, false)) && (IPUtil.isValidAddress(address, true));
collector.addInfo(address, port, 0, getHeadersLength(address) + blockToSend.length, isLocal);
if(logMINOR) Logger.minor(this, "Sent packet length "+blockToSend.length+" to "+address+':'+port);
} catch (IOException e) {
} catch (IOException | UnsupportedAddressTypeException e) {
if(packet.getAddress() instanceof Inet6Address) {
Logger.normal(this, "Error while sending packet to IPv6 address: "+destination+": "+e);
} else {
Expand Down

0 comments on commit 0857c38

Please sign in to comment.