According to our profile, this function accounts for a huge amount of the total calls to malloc() that we do. Although I don't think it accounts for much allocation at any given time, it is probably slowing us down.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
...
Show closed items
Linked items
0
Link issues together to show that they're related.
Learn more.
However, for some reason this makes entrynodes/node_filter fail. Couldn't figure out yet. Can anyone spot the key difference between old code and new code?
I don't think this will actually return the same results as the old function.
In the case when the bridge has no identity set, but where the node does have an identity (*), this code will always return "false" -- but the old code would check the addresses in that case.
There may be other cases when the outputs are different; I'm not sure that I spotted them all.
(*) I think the node will always have an identity, in fact.
Here's the behavior that I think we had before, and which I think we want:
A node will match every bridge_info_t with the same identity.
A node will match every bridge_info_t with no identity set, if that bridge_info_t has the same address in the routerinfo, the routerstatus, or the microdescriptor.
To test this, when I squashed the branch, I tried taking only the unit tests, with none of the bridges.c changes, and making sure that they passed on the old bridges.c code as well as the new. They did! So, that's good.
But then I was worried that you hadn't tested the case where a bridge had a matching address but a mismatched digest. In fact, I thought it wouldn't work, since I had forgotten how get_configured_bridge_by_addr_port_digest actually behaved... So I added a test for that too -- and the code still passes before and after.
Nicely done! I think this code is correct.
I'm merging bug27224_take2_squashed to master now. It's the same as your branch, squashed and rearranged, with an extra test.
Trac: Resolution: N/Ato implemented Status: needs_review to closed