projects
/
org.ibex.jinetd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
7b717a4
)
make jinetd relocatable
author
adam
<adam@megacz.com>
Sat, 24 Jul 2004 05:42:22 +0000
(
05:42
+0000)
committer
adam
<adam@megacz.com>
Sat, 24 Jul 2004 05:42:22 +0000
(
05:42
+0000)
darcs-hash:
20040724054222
-5007d-
7cd316d8e672cbcf51c2efe9053c7ff625672413
.gz
src/org/ibex/jinetd/Loader.java
patch
|
blob
|
history
src/org/ibex/jinetd/Main.java
patch
|
blob
|
history
src/org/ibex/jinetd/Port.java
patch
|
blob
|
history
src/org/ibex/jinetd/Root.java
patch
|
blob
|
history
diff --git
a/src/org/ibex/jinetd/Loader.java
b/src/org/ibex/jinetd/Loader.java
index
5c933c7
..
0d6ca14
100644
(file)
--- a/
src/org/ibex/jinetd/Loader.java
+++ b/
src/org/ibex/jinetd/Loader.java
@@
-42,11
+42,11
@@
public class Loader extends Watcher {
File bindir = new File(this.path + File.separatorChar + "BIN"); bindir.mkdirs();
File libdir = new File(this.path + File.separatorChar + "LIB");
String classpath = System.getProperty("java.class.path");
File bindir = new File(this.path + File.separatorChar + "BIN"); bindir.mkdirs();
File libdir = new File(this.path + File.separatorChar + "LIB");
String classpath = System.getProperty("java.class.path");
- String [] l = new File("/jinetd/LIB/").list();
+ String [] l = new File(Root.root + "/LIB/").list();
for(int i=0; i<l.length; i++) {
if (!l[i].endsWith(".jar")) continue;
classpath += File.pathSeparatorChar;
for(int i=0; i<l.length; i++) {
if (!l[i].endsWith(".jar")) continue;
classpath += File.pathSeparatorChar;
- classpath += "/jinetd/LIB/" + l[i];
+ classpath += Root.root + "/LIB/" + l[i];
}
String bootclasspath = System.getProperty("sun.boot.class.path", "");
Vec args = new Vec();
}
String bootclasspath = System.getProperty("sun.boot.class.path", "");
Vec args = new Vec();
diff --git
a/src/org/ibex/jinetd/Main.java
b/src/org/ibex/jinetd/Main.java
index
e32a32c
..
a8ae366
100644
(file)
--- a/
src/org/ibex/jinetd/Main.java
+++ b/
src/org/ibex/jinetd/Main.java
@@
-5,12
+5,11
@@
import java.util.*;
public class Main {
public class Main {
- public static Root root = new Root(System.getProperty("jinetd.root", "/jinetd"));
public static void main(String[] s) throws Exception {
Log.color = true;
public static void main(String[] s) throws Exception {
Log.color = true;
+ Root root = new Root(Root.root);
while(true) try {
Thread.sleep(1000);
while(true) try {
Thread.sleep(1000);
- //Log.info(Main.class, "scanning...");
if (root != null) root.scan();
} catch (Exception e) { Log.error(Main.class, e); }
}
if (root != null) root.scan();
} catch (Exception e) { Log.error(Main.class, e); }
}
diff --git
a/src/org/ibex/jinetd/Port.java
b/src/org/ibex/jinetd/Port.java
index
2aded0a
..
f00e0de
100644
(file)
--- a/
src/org/ibex/jinetd/Port.java
+++ b/
src/org/ibex/jinetd/Port.java
@@
-8,13
+8,13
@@
import java.util.zip.*;
public class Port extends Loader {
public class Port extends Loader {
- private final NetworkInterface iface;
+ private final InetAddress bindTo;
private final int port;
private final Thread listener;
private final int port;
private final Thread listener;
- public Port(String path, NetworkInterface iface, int port) {
+ public Port(String path, InetAddress bindTo, int port) {
super(path);
super(path);
- this.iface = iface;
+ this.bindTo = bindTo;
this.port = port;
this.listener = new PortThread();
listener.start();
this.port = port;
this.listener = new PortThread();
listener.start();
@@
-86,8
+86,8
@@
public class Port extends Loader {
private class PortThread extends Thread {
public void run() {
try {
private class PortThread extends Thread {
public void run() {
try {
- Log.warn(this, "Now listening on interface " + iface + ", port " + port);
- ServerSocket ss = new ServerSocket(port);
+ Log.warn(this, "Now listening on address " + bindTo + ", port " + port);
+ ServerSocket ss = bindTo == null ? new ServerSocket(port) : new ServerSocket(port, 0, bindTo);
for(Socket s = ss.accept(); ; s = ss.accept()) try {
Log.warn(this, "accepted connection on port " + port);
dispatch(new Connection(s, "megacz.com"));
for(Socket s = ss.accept(); ; s = ss.accept()) try {
Log.warn(this, "accepted connection on port " + port);
dispatch(new Connection(s, "megacz.com"));
diff --git
a/src/org/ibex/jinetd/Root.java
b/src/org/ibex/jinetd/Root.java
index
b844c9b
..
6b5467d
100644
(file)
--- a/
src/org/ibex/jinetd/Root.java
+++ b/
src/org/ibex/jinetd/Root.java
@@
-6,6
+6,7
@@
import java.net.*;
public class Root extends Loader {
public class Root extends Loader {
+ public static String root = System.getProperty("jinetd.root", "/jinetd");
private final Host host;
private final Watched port;
private final Host host;
private final Watched port;
@@
-32,7
+33,7
@@
public class Root extends Loader {
Log.warn(this, "/host changed");
} else if (w.part.equals("port")) {
Log.warn(this, "/port changed");
Log.warn(this, "/host changed");
} else if (w.part.equals("port")) {
Log.warn(this, "/port changed");
- } else if (w.getAbsolutePath().startsWith("/jinetd/LIB/")) {
+ } else if (w.getAbsolutePath().startsWith(Root.root + "/LIB/")) {
if (w.lastModifiedAtLastScan != -1) {
Log.error(this, "jinetd upgraded; bouncing the JVM....");
reboot();
if (w.lastModifiedAtLastScan != -1) {
Log.error(this, "jinetd upgraded; bouncing the JVM....");
reboot();
@@
-49,7
+50,7
@@
public class Root extends Loader {
String portnum = part.indexOf(':') == -1 ? part : part.substring(part.indexOf(':') + 1);
try {
return new Port(this.path + File.separatorChar + part,
String portnum = part.indexOf(':') == -1 ? part : part.substring(part.indexOf(':') + 1);
try {
return new Port(this.path + File.separatorChar + part,
- ipaddr == null ? null : NetworkInterface.getByInetAddress(InetAddress.getByName(ipaddr)),
+ ipaddr == null ? null : InetAddress.getByName(ipaddr),
portnum.equals("*") ? 0 : Integer.parseInt(portnum));
} catch (UnknownHostException e) { Log.warn(this, "can't resolve host for port directory: " + part);
} catch (NumberFormatException e) { Log.warn(this, "invalid port directory: " + part);
portnum.equals("*") ? 0 : Integer.parseInt(portnum));
} catch (UnknownHostException e) { Log.warn(this, "can't resolve host for port directory: " + part);
} catch (NumberFormatException e) { Log.warn(this, "invalid port directory: " + part);