Commit Graph

27 Commits

Author SHA1 Message Date
Aarsh Shah
cdec762f40 fix add addrs bug 2020-03-28 16:17:10 +05:30
Aarsh Shah
9868efd05f fix memory store signed peer record bug 2020-03-27 16:18:53 +05:30
Yusef Napora
59abcf549d
Certified addresses (#98) 2020-03-06 12:07:36 +00:00
Steven Allen
b4dc608f50 chore(dep): update go-log 2020-02-17 11:38:14 -05:00
Steven Allen
2fb6d7a48f fix multiple TTL bugs
The first fix independently extends the address expiration time and the address
TTL:

By example:

* We have an address with a TTL of 4s that will expire in 1s.
* We update it with a TTL of 3s.

Before this change:

* We end up with an address with a TTL of 3s that will expire in 3s.

After this change:

* We end up with an address with a TTL of 4s that will expire in 3s.

---

The second fix prevents the in-memory addressbook from announcing existing
addresses every time their TTLs get updated.

---

The third fix correctly updates TTLs for existing addresses in the on-disk
addressbook.

This fixes https://github.com/libp2p/go-libp2p-identify/issues/2
2019-07-24 17:04:37 -07:00
Steven Allen
491519a817 reduce allocations when adding addrs 2019-06-28 13:26:17 +02:00
Steven Allen
0b5b389640 dep: switch to core (#80)
* dep: switch to core

Specifically, remove go-libp2p-{crypto,peer} deps.

* catch a few more usages of deprecated packages.
2019-05-31 14:51:16 +01:00
vyzo
28b1a9f31d don't track segment sizes, it's a fruitless optimization 2019-05-17 23:39:21 +03:00
vyzo
afca355218 index the peer ID strings directly to avoid copying the byte slice 2019-05-17 23:36:46 +03:00
vyzo
d340d2983e cosmetics 2019-05-17 13:14:39 +03:00
vyzo
5ed17f0b79 embed lock in segment 2019-05-17 12:37:46 +03:00
vyzo
08caa87351 refactor protocol functionality into ProtoBook 2019-05-17 12:33:33 +03:00
vyzo
303b1b6207 update segment size on gc 2019-05-09 11:20:12 +03:00
Raúl Kripalani
e7e511ba99 segment the memory peerstore; granular locks. 2019-05-09 00:27:58 +01:00
vyzo
f21f6eac4f don't eager gc 2019-04-28 16:21:07 +03:00
vyzo
c58ce1f56f add Close method to memory address book, which cancels the gc process 2019-04-28 12:19:26 +03:00
vyzo
e4cf50160f periodically schedule gc 2019-04-28 12:17:48 +03:00
vyzo
d0a3cc17f4 don't delete under the read lock
let gc clean up the addrs
2019-04-28 11:35:23 +03:00
vyzo
0ddad15bd2 read/write address book lock 2019-04-27 22:19:39 +03:00
Steven Allen
68a73712e1 store expiring addrs by pointer
Hopefully, this reduces the space wasted by using maps (see the comment in the
committed code).
2018-10-14 15:11:35 +01:00
Steven Allen
6daee68364
memoryAddrBook: document gc precondition 2018-10-03 17:42:54 -07:00
Steven Allen
e3a2970d93 add garbage collection for in-memory peerstore
There are better ways to do this but pausing dialing once an hour likely isn't
going to break anything and is the simplest approach.
2018-10-02 10:49:55 -07:00
Steven Allen
6d5cedf098 revert to storing peer addresses in a map
We switched to a slice to reduce the amount of memory the peerstore ended up
taking up unfortunately, this really killed us in allocations. Looking at
go-ipfs profiles, I'm worried that memory fragmentation is killing us so I'd
like to revert to the old behavior.

Note: The real solution here is dealing with "address abusers".
2018-10-01 22:16:08 -07:00
Raúl Kripalani
4e0c2169c7 Resolve TODO. 2018-09-12 13:42:26 +01:00
Raúl Kripalani
1c25f160a1 normalise import aliases. 2018-09-07 18:46:23 +01:00
Raúl Kripalani
171f051aa1 add tests for keybook; []peer.ID => peer.IDSlice. 2018-09-07 13:04:14 +01:00
Raúl Kripalani
7f4288fab1 rename package mem => pstoremem. 2018-09-04 18:07:44 +01:00