resolve master
authoradam <adam@megacz.com>
Sun, 9 Jul 2006 06:51:37 +0000 (06:51 +0000)
committeradam <adam@megacz.com>
Sun, 9 Jul 2006 06:51:37 +0000 (06:51 +0000)
darcs-hash:20060709065137-5007d-65535ab72f57502f36cd88ec39bdab3f79b4673f.gz

src/org/ibex/jinetd/Host.java
www/index.html

index 97942a8..0a27734 100644 (file)
@@ -34,11 +34,14 @@ public class Host extends TreeClassLoader {
     public static void init(String path, String host, int depth, ClassLoader pcl) {
        if (!new File(path).exists() || !new File(path).isDirectory()) return;
         try {
     public static void init(String path, String host, int depth, ClassLoader pcl) {
        if (!new File(path).exists() || !new File(path).isDirectory()) return;
         try {
-            InetAddress.getByName(host);
+           Log.warn(Host.class, "resolving " + host);
+            InetAddress ia = InetAddress.getByName(host);
             String pad = "";
             while(pad.length() + host.length() < 30) pad += " ";
             String pad = "";
             while(pad.length() + host.length() < 30) pad += " ";
-            Log.info(Main.class, pad + host + " => " + path);
-            hosts.put(host, pcl = new Host(path, host, pcl));
+            if (ia.equals(InetAddress.getLocalHost())) {
+                Log.info(Main.class, pad + host + " => " + path);
+                hosts.put(host, pcl = new Host(path, host, pcl));
+            }
         } catch (UnknownHostException e) {
             if (depth >= 3) return;
         }
         } catch (UnknownHostException e) {
             if (depth >= 3) return;
         }
index 2f99367..2ceb80c 100644 (file)
@@ -10,6 +10,85 @@ Jinetd does for TCP what servlet containers do for HTTP.
 <h3> Isn't HTTP all that matters? </h3>
 
 There are now Java servers for almost every network protocol: HTTP,
 <h3> Isn't HTTP all that matters? </h3>
 
 There are now Java servers for almost every network protocol: HTTP,
+SMTP, IMAP, POP3, NNTP, DNS, SSH, CIFS/SMB, and plenty of others.
+Using servers written in buffer-overflow-free languages is the most
+important step towards maintaining network security and stopping
+worms.
+
+<h3> Huh? </h3>
+
+Jinetd listens on the ports and interfaces you specify.  When it
+receives a connection, it loads the code designated to handle that
+protocol and hands off the connection.
+
+<h3> Isn't that trivially simple? </h3>
+
+While jinetd is an extremely lightweight server, it allows multiple
+different network protocol handlers to share the following facilities:
+
+<ul><li> No need for "start", "stop", or "reload" commands:
+    <ul>
+        <li> Automatic reloading of services when a .jar, .class, or
+             .java file changes; just drop in the new code or
+             <tt>touch</tt> the jar file to trigger a restart.
+
+        <li> Services can add their own configuration files to the
+             "watched" list.
+
+        <li> Connections are always accepted immediately, even if the
+             service's code is still initializing itself.  The
+             connection is paused until the service finishes loading,
+             at which point it is handled.  No more "503 Server
+             Unavailable" messages for your users when you restart a
+             context; the user just experiences a brief delay before
+             the webpage loads.
+    </ul>
+
+    <li> Edit-in-place development
+    <ul>
+        <li> Automatic compilation of .java files for a service;
+             automatic reload once compilation completes
+    </ul>
+
+    <li> Self-restart
+    <ul>
+        <li> jinetd is usually invoked from a "respawn" line in /etc/inittab
+
+        <li> when it detects that its .jar files have been modified,
+             it exits and lets init respawn it
+
+        <li> when resources run critically low (ie low memory), jinetd
+             will abort the JVM and let init respawn it -- the only
+             way to kill runaway threads in Java.
+    </ul>
+
+    <li> No configuration files to edit -- host-to-service and
+         port-to-service mappings are inferred from directory layout.
+
+    <li> Shared virtual host settings
+    <ul>
+    <li> Arrange your content by (virtual) host rather than by service
+         -- for example, the HTTP and NNTP content for
+         "www.megacz.com" are kept side by side in
+         "/jinetd/host/com/megacz/HTTP" and
+         "/jinetd/host/com/megacz/NNTP".
+    </ul>
+
+</ul>
+
+</body>
+</html>
+v v v v v v v
+*************
+<h1>Jinetd: inetd for Java</h1>
+
+<h3> What is it? </h3>
+
+Jinetd does for TCP what servlet containers do for HTTP.
+
+<h3> Isn't HTTP all that matters? </h3>
+
+There are now Java servers for almost every network protocol: HTTP,
 SMTP, IMAP, POP3, NNTP, DNS, <a
 href=http://www.jcraft.com/jsch/>SSH</a>, <a
 href=http://telnetd.sourceforge.net/index.html>TELNET</a>, CIFS/SMB,
 SMTP, IMAP, POP3, NNTP, DNS, <a
 href=http://www.jcraft.com/jsch/>SSH</a>, <a
 href=http://telnetd.sourceforge.net/index.html>TELNET</a>, CIFS/SMB,
@@ -80,3 +159,5 @@ different network protocol handlers to share the following facilities:
 
 </body>
 </html>
 
 </body>
 </html>
+
+^ ^ ^ ^ ^ ^ ^
\ No newline at end of file