Skip to content

Commit

Permalink
don't serialize scopeids: that's broken
Browse files Browse the repository at this point in the history
  • Loading branch information
rmuir committed Aug 20, 2015
1 parent 2aa63d4 commit 10153cb
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public InetSocketTransportAddress(StreamInput in) throws IOException {
in.readFully(a);
InetAddress inetAddress;
if (len == 16) {
int scope_id = in.readInt();
inetAddress = Inet6Address.getByAddress(null, a, scope_id);
inetAddress = Inet6Address.getByAddress(null, a);
} else {
inetAddress = InetAddress.getByAddress(a);
}
Expand Down Expand Up @@ -122,8 +121,9 @@ public void writeTo(StreamOutput out) throws IOException {
byte[] bytes = address().getAddress().getAddress(); // 4 bytes (IPv4) or 16 bytes (IPv6)
out.writeByte((byte) bytes.length); // 1 byte
out.write(bytes, 0, bytes.length);
if (address().getAddress() instanceof Inet6Address)
out.writeInt(((Inet6Address) address.getAddress()).getScopeId());
// don't serialize scope ids over the network!!!!
// these only make sense with respect to the local machine, and will only formulate
// the address incorrectly remotely.
} else {
out.writeByte((byte) 1);
out.writeString(maybeLookupHostname());
Expand Down

0 comments on commit 10153cb

Please sign in to comment.