Thread: [jetrix-cvs] SF.net SVN: jetrix:[737] jetrix/trunk/src/java/net/jetrix/services/ PublishingService.
Brought to you by:
smanux
From: <sm...@us...> - 2008-08-22 15:27:55
|
Revision: 737 http://jetrix.svn.sourceforge.net/jetrix/?rev=737&view=rev Author: smanux Date: 2008-08-22 15:27:52 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Publish the server address to servers.tetrinet.fr only since the other directories are no longer available 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 2008-08-22 15:11:15 UTC (rev 736) +++ jetrix/trunk/src/java/net/jetrix/services/PublishingService.java 2008-08-22 15:27:52 UTC (rev 737) @@ -60,7 +60,7 @@ public PublishingService() { setDelay(1000); - setPeriod(24 * 3600 * 1000); + setPeriod(24 * 3600 * 1000); // 24 hours } public void setHost(String host) @@ -91,32 +91,18 @@ log.info("Publishing server address to online directories... (" + host + ")"); - // publishing to tetrinet.org + // publishing to servers.tetrinet.fr try { - String url = "http://slummy.tetrinet.org/grav/slummy_addsvr.pl"; + String url = "http://servers.tetrinet.fr/server-add.jsp"; Map<String, String> params = new HashMap<String, String>(); - params.put("qname", host); - params.put("submit_bt", "Add Server"); - post(url, params); - } - catch (IOException e) - { - e.printStackTrace(); - } - - // publishing to tsrv.com - try - { - String url = "http://dieterdhoker.mine.nu:8280/cgi-bin/TSRV/submitserver.pl"; - Map<String, String> params = new HashMap<String, String>(); params.put("hostname", host); params.put("description", Server.getInstance().getConfig().getName()); post(url, params); } catch (IOException e) { - e.printStackTrace(); + log.log(Level.WARNING, "Unable to publish the server on http://servers.tetrinet.fr", e); } } @@ -168,7 +154,7 @@ // send the request conn.connect(); - if (log.isLoggable(Level.FINE)) + if (log.isLoggable(Level.FINE) && conn.getResponseCode() >= 400) { log.fine("Response: " + conn.getResponseCode() + " - " + conn.getResponseMessage()); @@ -182,7 +168,6 @@ in.close(); } - } finally { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |