node: Move the session lookup outside the loop
Small code change that was not possible before.
This commit is contained in:
parent
189046bb5d
commit
4a497fa66f
|
|
@ -1570,10 +1570,12 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let mut missing = Vec::new();
|
let mut missing = Vec::new();
|
||||||
|
let nid = *self.nid();
|
||||||
|
|
||||||
for id in message.inventory.as_slice() {
|
// Here we handle the special case where the inventory we received is that of
|
||||||
// TODO: Move this out (good luck with the borrow checker).
|
// a connected peer, as opposed to being relayed to us.
|
||||||
if let Some(sess) = self.sessions.get_mut(announcer) {
|
if let Some(sess) = self.sessions.get_mut(announcer) {
|
||||||
|
for id in message.inventory.as_slice() {
|
||||||
// If we are connected to the announcer of this inventory, update the peer's
|
// If we are connected to the announcer of this inventory, update the peer's
|
||||||
// subscription filter to include all inventory items. This way, we'll
|
// subscription filter to include all inventory items. This way, we'll
|
||||||
// relay messages relating to the peer's inventory.
|
// relay messages relating to the peer's inventory.
|
||||||
|
|
@ -1588,7 +1590,7 @@ where
|
||||||
) {
|
) {
|
||||||
// Only if we do not have the repository locally do we fetch here.
|
// Only if we do not have the repository locally do we fetch here.
|
||||||
// If we do have it, only fetch after receiving a ref announcement.
|
// If we do have it, only fetch after receiving a ref announcement.
|
||||||
match self.db.routing().entry(id, self.nid()) {
|
match self.db.routing().entry(id, &nid) {
|
||||||
Ok(entry) => {
|
Ok(entry) => {
|
||||||
if entry.is_none() {
|
if entry.is_none() {
|
||||||
missing.push(*id);
|
missing.push(*id);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue