forked from I2P_Developers/i2p.i2p
- Hide I2CP settings when in router context
- Better BEValue.toString() (most of the following got missed in the last checkin) - Fix about 9 NPEs - Fix numwant in magnet mode - Send metadata size in extension handshake - Open trackers are primary if we don't have primary trackers - Add missing break in port message handling - Increase max msg size to account for metadata msg - Remember magnets across restarts - Drop peers w/o extensions if we need metainfo - Fix DATA messages - Fix tracker transition to non-magnet - Fix infohash for non-magnet - Fix up peer transition to non-magnet - More logging
This commit is contained in:
@ -120,7 +120,7 @@ public class Peer implements Comparable
|
||||
this.peerID = new PeerID(id, sock.getPeerDestination());
|
||||
_id = ++__id;
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Creating a new peer with " + peerID.toString(), new Exception("creating " + _id));
|
||||
_log.debug("Creating a new peer " + peerID.toString(), new Exception("creating " + _id));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -261,14 +261,22 @@ public class Peer implements Comparable
|
||||
_log.debug("Already have din [" + sock + "] with " + toString());
|
||||
}
|
||||
|
||||
// bad idea?
|
||||
if (metainfo == null && (options & OPTION_EXTENSION) == 0) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Peer does not support extensions and we need metainfo, dropping");
|
||||
throw new IOException("Peer does not support extensions and we need metainfo, dropping");
|
||||
}
|
||||
|
||||
PeerConnectionIn in = new PeerConnectionIn(this, din);
|
||||
PeerConnectionOut out = new PeerConnectionOut(this, dout);
|
||||
PeerState s = new PeerState(this, listener, metainfo, in, out);
|
||||
|
||||
if ((options & OPTION_EXTENSION) != 0) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Peer supports extensions, sending test message");
|
||||
out.sendExtension(0, ExtensionHandler.getHandshake());
|
||||
_log.debug("Peer supports extensions, sending reply message");
|
||||
int metasize = metainfo != null ? metainfo.getInfoBytes().length : -1;
|
||||
out.sendExtension(0, ExtensionHandler.getHandshake(metasize));
|
||||
}
|
||||
|
||||
if ((options & OPTION_DHT) != 0 && util.getDHT() != null) {
|
||||
@ -423,6 +431,7 @@ public class Peer implements Comparable
|
||||
* @since 0.8.4
|
||||
*/
|
||||
public void setMetaInfo(MetaInfo meta) {
|
||||
metainfo = meta;
|
||||
PeerState s = state;
|
||||
if (s != null)
|
||||
s.setMetaInfo(meta);
|
||||
|
Reference in New Issue
Block a user