I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 8655988c authored by zzz's avatar zzz
Browse files

* NTCP: Handle race where peer's NTCP address goes away

parent de5f2940
No related branches found
No related tags found
No related merge requests found
...@@ -212,6 +212,7 @@ public class NTCPTransport extends TransportImpl { ...@@ -212,6 +212,7 @@ public class NTCPTransport extends TransportImpl {
Hash ih = ident.calculateHash(); Hash ih = ident.calculateHash();
NTCPConnection con = null; NTCPConnection con = null;
boolean isNew = false; boolean isNew = false;
boolean fail = false;
synchronized (_conLock) { synchronized (_conLock) {
con = _conByIdent.get(ih); con = _conByIdent.get(ih);
if (con == null) { if (con == null) {
...@@ -223,11 +224,19 @@ public class NTCPTransport extends TransportImpl { ...@@ -223,11 +224,19 @@ public class NTCPTransport extends TransportImpl {
_log.debug("Send on a new con: " + con + " at " + addr + " for " + ih); _log.debug("Send on a new con: " + con + " at " + addr + " for " + ih);
_conByIdent.put(ih, con); _conByIdent.put(ih, con);
} else { } else {
_log.error("we bid on a peer who doesn't have an ntcp address? " + target); // race, RI changed out from under us
return; // call afterSend below outside of conLock
fail = true;
} }
} }
} }
if (fail) {
// race, RI changed out from under us, maybe SSU can handle it
if (_log.shouldLog(Log.WARN))
_log.warn("we bid on a peer who doesn't have an ntcp address? " + target);
afterSend(msg, false);
return;
}
if (isNew) { if (isNew) {
con.enqueueInfoMessage(); // enqueues a netDb store of our own info con.enqueueInfoMessage(); // enqueues a netDb store of our own info
con.send(msg); // doesn't do anything yet, just enqueues it con.send(msg); // doesn't do anything yet, just enqueues it
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment