Author: toad
Date: 2007-09-25 19:51:18 +0000 (Tue, 25 Sep 2007)
New Revision: 15307
Modified:
trunk/freenet/src/freenet/io/comm/FreenetInetAddress.java
trunk/freenet/src/freenet/io/comm/Peer.java
Log:
Remove back compat cruft
Modified: trunk/freenet/src/freenet/io/comm/FreenetInetAddress.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/FreenetInetAddress.java 2007-09-25
16:49:20 UTC (rev 15306)
+++ trunk/freenet/src/freenet/io/comm/FreenetInetAddress.java 2007-09-25
19:51:18 UTC (rev 15307)
@@ -46,10 +46,7 @@
ba = new byte[4];
dis.readFully(ba);
} else {
- // Old format IPv4 address
- ba = new byte[4];
- ba[0] = (byte)firstByte;
- dis.readFully(ba, 1, 3);
+ throw new IOException("Unknown type byte (old form?
corrupt stream? too short/long prev field?): "+(int)firstByte);
}
_address = InetAddress.getByAddress(ba);
String name = null;
@@ -329,19 +326,14 @@
return hostname;
}
- public void writeToDataOutputStream(DataOutputStream dos, boolean
oldForm) throws IOException {
+ public void writeToDataOutputStream(DataOutputStream dos) throws
IOException {
InetAddress addr = this.getAddress();
if (addr == null) throw new UnknownHostException();
byte[] data = addr.getAddress();
- if(oldForm) {
- if(data.length != 4)
- throw new IllegalArgumentException("IPv6 not
supported at present");
- } else {
- if(data.length == 4)
- dos.write(0);
- else
- dos.write(255);
- }
+ if(data.length == 4)
+ dos.write(0);
+ else
+ dos.write(255);
dos.write(data);
if(hostname != null)
dos.writeUTF(hostname);
Modified: trunk/freenet/src/freenet/io/comm/Peer.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/Peer.java 2007-09-25 16:49:20 UTC (rev
15306)
+++ trunk/freenet/src/freenet/io/comm/Peer.java 2007-09-25 19:51:18 UTC (rev
15307)
@@ -219,8 +219,8 @@
return addr.toString() + ':' + _port;
}
- public void writeToDataOutputStream(DataOutputStream dos, boolean
oldForm) throws IOException {
- addr.writeToDataOutputStream(dos, oldForm);
+ public void writeToDataOutputStream(DataOutputStream dos) throws
IOException {
+ addr.writeToDataOutputStream(dos);
dos.writeInt(_port);
}