* i2psnark: Fix bug preventing Robert from connecting to snark (thx sponge)

This commit is contained in:
zzz
2011-05-28 20:11:52 +00:00
parent c9c35a3e5a
commit 1eb58a84df
3 changed files with 7 additions and 3 deletions

View File

@ -130,7 +130,8 @@ public class PeerAcceptor
}
}
private static final int LOOKAHEAD_SIZE = "19".length() +
/** 48 */
private static final int LOOKAHEAD_SIZE = 1 + // chr(19)
"BitTorrent protocol".length() +
8 + // blank, reserved
20; // infohash
@ -144,7 +145,7 @@ public class PeerAcceptor
if (read != buf.length)
throw new IOException("Unable to read the hash (read " + read + ")");
byte rv[] = new byte[20];
System.arraycopy(buf, buf.length-rv.length-1, rv, 0, rv.length);
System.arraycopy(buf, buf.length-rv.length, rv, 0, rv.length);
return rv;
}
}