* 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, splitting the swarm.
   (http://zzz.i2p/topics/1327 thx 'backup')
This commit is contained in:
zzz
2013-06-23 15:21:40 +00:00
parent 5ba86ca254
commit ac9392b9e6
3 changed files with 18 additions and 5 deletions

View File

@ -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);

View File

@ -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

View File

@ -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 = "";