fix a NPE
This commit is contained in:
@ -549,16 +549,20 @@ public class EstablishState {
|
|||||||
Signature sig = new Signature(s);
|
Signature sig = new Signature(s);
|
||||||
_verified = _context.dsa().verifySignature(sig, toVerify, alice.getSigningPublicKey());
|
_verified = _context.dsa().verifySignature(sig, toVerify, alice.getSigningPublicKey());
|
||||||
if (_verified) {
|
if (_verified) {
|
||||||
byte[] ip = _con.getChannel().socket().getInetAddress().getAddress();
|
// get inet-addr
|
||||||
|
InetAddress addr = this._con.getChannel().socket().getInetAddress();
|
||||||
|
byte[] ip = (addr == null) ? null : addr.getAddress();
|
||||||
if (_context.shitlist().isShitlistedForever(alice.calculateHash())) {
|
if (_context.shitlist().isShitlistedForever(alice.calculateHash())) {
|
||||||
if (_log.shouldLog(Log.WARN))
|
if (_log.shouldLog(Log.WARN))
|
||||||
_log.warn("Dropping inbound connection from permanently shitlisted peer: " + alice.calculateHash().toBase64());
|
_log.warn("Dropping inbound connection from permanently shitlisted peer: " + alice.calculateHash().toBase64());
|
||||||
// So next time we will not accept the con from this IP,
|
// So next time we will not accept the con from this IP,
|
||||||
// rather than doing the whole handshake
|
// rather than doing the whole handshake
|
||||||
|
if(ip != null)
|
||||||
_context.blocklist().add(ip);
|
_context.blocklist().add(ip);
|
||||||
fail("Peer is shitlisted forever: " + alice.calculateHash().toBase64());
|
fail("Peer is shitlisted forever: " + alice.calculateHash().toBase64());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(ip != null)
|
||||||
_transport.setIP(alice.calculateHash(), ip);
|
_transport.setIP(alice.calculateHash(), ip);
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug(prefix() + "verification successful for " + _con);
|
_log.debug(prefix() + "verification successful for " + _con);
|
||||||
|
Reference in New Issue
Block a user