[jetrix-cvs] SF.net SVN: jetrix:[871] jetrix/trunk/src/java/net/jetrix/services/ PublishingService.
Brought to you by:
smanux
|
From: <sm...@us...> - 2011-04-20 07:46:18
|
Revision: 871
http://jetrix.svn.sourceforge.net/jetrix/?rev=871&view=rev
Author: smanux
Date: 2011-04-20 07:46:12 +0000 (Wed, 20 Apr 2011)
Log Message:
-----------
6to4 addresses are no longer submitted to the server directory
Modified Paths:
--------------
jetrix/trunk/src/java/net/jetrix/services/PublishingService.java
Modified: jetrix/trunk/src/java/net/jetrix/services/PublishingService.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/services/PublishingService.java 2010-09-16 20:50:33 UTC (rev 870)
+++ jetrix/trunk/src/java/net/jetrix/services/PublishingService.java 2011-04-20 07:46:12 UTC (rev 871)
@@ -25,6 +25,7 @@
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.HttpURLConnection;
+import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
@@ -52,7 +53,6 @@
*/
public class PublishingService extends ScheduledService
{
-
private Logger log = Logger.getLogger("net.jetrix");
private String host;
@@ -226,7 +226,8 @@
InetAddress addr = addresses.nextElement();
if (!addr.isLoopbackAddress()
&& !addr.isLinkLocalAddress()
- && !addr.isSiteLocalAddress())
+ && !addr.isSiteLocalAddress()
+ && !is6to4(addr))
{
address = addr;
}
@@ -235,10 +236,18 @@
}
catch (SocketException e)
{
- log.log(Level.WARNING, e.getMessage(), e);
+ log.log(Level.WARNING, "Couldn't find the network address", e);
}
return address;
}
+ /**
+ * Check if the specified address is a 6to4 address (an IPv6 address starting with the 2002: prefix).
+ * @since 0.3
+ */
+ private boolean is6to4(InetAddress addr)
+ {
+ return (addr instanceof Inet6Address) && addr.getHostName().startsWith("2002");
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|