Skip to content

Commit

Permalink
Better name
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Jun 24, 2023
1 parent 83d1d9f commit 582ee31
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/test/java/org/apache/commons/net/tftp/TFTPServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ public void write(final int b) {
private File serverReadDirectory;
private File serverWriteDirectory;
private final int port;
private final InetAddress laddr;
private final InetAddress localAddress;

private Exception serverException;

Expand All @@ -489,17 +489,17 @@ public void write(final int b) {
* @param serverReadDirectory directory for GET requests
* @param serverWriteDirectory directory for PUT requests
* @param port The local port to bind to.
* @param localaddr The local address to bind to.
* @param localAddress The local address to bind to.
* @param mode A value as specified above.
* @param log Stream to write log message to. If not provided, uses System.out
* @param errorLog Stream to write error messages to. If not provided, uses System.err.
* @throws IOException if the server directory is invalid or does not exist.
*/
public TFTPServer(final File serverReadDirectory, final File serverWriteDirectory, final int port, final InetAddress localaddr, final ServerMode mode,
public TFTPServer(final File serverReadDirectory, final File serverWriteDirectory, final int port, final InetAddress localAddress, final ServerMode mode,
final PrintStream log, final PrintStream errorLog) throws IOException {
this.port = port;
this.mode = mode;
this.laddr = localaddr;
this.localAddress = localAddress;
this.log = log == null ? nullStream : log;
this.logError = errorLog == null ? nullStream : errorLog;
launch(serverReadDirectory, serverWriteDirectory);
Expand Down Expand Up @@ -527,16 +527,16 @@ public TFTPServer(final File serverReadDirectory, final File serverWriteDirector
final PrintStream log, final PrintStream errorLog) throws IOException {
this.mode = mode;
this.port = port;
InetAddress iaddr = null;
InetAddress inetAddress = null;
if (localiface != null) {
final Enumeration<InetAddress> ifaddrs = localiface.getInetAddresses();
if ((ifaddrs != null) && ifaddrs.hasMoreElements()) {
iaddr = ifaddrs.nextElement();
inetAddress = ifaddrs.nextElement();
}
}
this.log = log == null ? nullStream : log;
this.logError = errorLog == null ? nullStream : errorLog;
this.laddr = iaddr;
this.localAddress = inetAddress;
launch(serverReadDirectory, serverWriteDirectory);
}

Expand All @@ -563,7 +563,7 @@ public TFTPServer(final File serverReadDirectory, final File serverWriteDirector
this.mode = mode;
this.log = log == null ? nullStream : log;
this.logError = errorLog == null ? nullStream : errorLog;
this.laddr = null;
this.localAddress = null;
launch(serverReadDirectory, serverWriteDirectory);
}

Expand Down Expand Up @@ -646,8 +646,8 @@ private void launch(final File newServerReadDirectory, final File newServerWrite
// we want the server thread to listen forever.
serverTftp.setDefaultTimeout(Duration.ZERO);

if (laddr != null) {
serverTftp.open(port, laddr);
if (localAddress != null) {
serverTftp.open(port, localAddress);
} else {
serverTftp.open(port);
}
Expand Down

0 comments on commit 582ee31

Please sign in to comment.