You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ra...@apache.org on 2003/01/20 16:17:57 UTC
cvs commit: jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver FtpDataConnection.java
rana_b 2003/01/20 07:17:57
Modified: ftpserver/src/java/org/apache/avalon/ftpserver
FtpDataConnection.java
Log:
making it firewall friendly
Revision Changes Path
1.9 +10 -7 jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/FtpDataConnection.java
Index: FtpDataConnection.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/FtpDataConnection.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FtpDataConnection.java 29 Oct 2002 17:06:20 -0000 1.8
+++ FtpDataConnection.java 20 Jan 2003 15:17:57 -0000 1.9
@@ -68,6 +68,7 @@
catch(Exception ex) {
mConfig.getLogger().warn("FtpDataConnection.closeDataSocket()", ex);
}
+ mConfig.releaseDataPort(miPort);
mServSoc = null;
}
}
@@ -101,8 +102,12 @@
try {
// open passive server socket and get parameters
- mServSoc = new ServerSocket(getPassivePort(), 1, mConfig.getSelfAddress());
- mAddress = mConfig.getSelfAddress();
+ int port = getPassivePort();
+ if(port == -1) {
+ throw new Exception("No available port found for PASV connection.");
+ }
+ mServSoc = new ServerSocket(port, 1, mConfig.getSelfAddress());
+ mAddress = mConfig.getServerAddress();
miPort = mServSoc.getLocalPort();
// set different state variables
@@ -159,13 +164,11 @@
/**
- * Get the passive port. Later we shall use only predefined
- * port range for passive connections.
+ * Get the passive port. Get it from the port pool.
*/
private int getPassivePort() {
- return 0;
+ return mConfig.getDataPort();
}
-
/**
* Dispose data connection
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>