OpenBazaar/OpenBazaar — pull request #401 by benemorius (2014-09-04 15:24:30+00:00)
Title: [WIP] DHT - No peer found... because didn't look

#396 fixes a serious DHT bug but the difference isn't really noticeable because there's another bug in the way.

It seems that the client is giving up on trying to contact a node whenever that node is not found in a k bucket. It doesn't matter if the node is known elsewhere like in `DHT::_activePeers`, because `CryptoTransportLayer::send()` only ever checks the k buckets, it seems.

**Therefore in this patch/hack I'm pulling the peer info from `DHT::_activePeers` when it isn't found in `TreeRoutingTable::_buckets`.**

I'm not certain where we *actually* should get the peer info from normally, but this patch is so far appearing to effect a good improvement for my nodes.

I think now that this is perhaps not the cause of #384 but there is some relevant discussion there worth linking to.

I still want to test this more but it looks like it might do just as much good as setting k really high, which I have confirmed over the last several hours does work really well.