diff --git a/apps/i2psnark/java/src/org/klomp/snark/MetaInfo.java b/apps/i2psnark/java/src/org/klomp/snark/MetaInfo.java index 810a10db08e7c66031eeba934261d9fd8c5edf9c..138f7d634139a0b4ad3b9423465be7a19c2bfd57 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/MetaInfo.java +++ b/apps/i2psnark/java/src/org/klomp/snark/MetaInfo.java @@ -501,12 +501,17 @@ public class MetaInfo * Creates a copy of this MetaInfo that shares everything except the * announce URL. * Drops any announce-list. + * Preserves infohash and info map, including any non-standard fields. + * @param announce may be null */ - public MetaInfo reannounce(String announce) + public MetaInfo reannounce(String announce) throws InvalidBEncodingException { - return new MetaInfo(announce, name, name_utf8, files, - lengths, piece_length, - piece_hashes, length, privateTorrent, null); + Map<String, BEValue> m = new HashMap(); + if (announce != null) + m.put("announce", new BEValue(DataHelper.getUTF8(announce))); + Map info = createInfoMap(); + m.put("info", new BEValue(info)); + return new MetaInfo(m); } /** @@ -539,6 +544,9 @@ public class MetaInfo // or else we will lose any non-standard keys and corrupt the infohash. if (infoMap != null) return Collections.unmodifiableMap(infoMap); + // we should only get here if serving a magnet on a torrent we created + if (_log.shouldLog(Log.WARN)) + _log.warn("Creating new infomap", new Exception()); // otherwise we must create it Map info = new HashMap(); info.put("name", name); diff --git a/history.txt b/history.txt index c281c07cfab6f73ffabcd8d72ec11a4c1e53d023..d9571dabde6096cb35abe750ded7729593c907f3 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,8 @@ +2013-06-23 zzz + * i2psnark: When receiving a metainfo via magnet and saving it to disk, + preserve all non-standard fields (such as those created by Robert) so the + infohash doesn't change on restart and split the swarm. + 2013-06-22 zzz * SSU: - Pad messages with random data instead of zeros diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index e36cd3b14352a16a1e79c5fea474cb2f20cbaa5c..7f4edb97520b081fa27255ad38c4da1068327822 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 12; + public final static long BUILD = 13; /** for example "-test" */ public final static String EXTRA = "";