From c8f577ad84674cea3659e53fc931085a0295b077 Mon Sep 17 00:00:00 2001 From: Stephen Whitmore Date: Tue, 12 Apr 2016 10:41:14 -0700 Subject: [PATCH] addSafe notes --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dd40eb2..37596d2 100644 --- a/README.md +++ b/README.md @@ -57,9 +57,14 @@ a [multiaddr](https://github.com/jbenet/js-multiaddr). ## peer.multiaddr.addSafe(addr) -Adds a new multiaddress that `peer` can be reached at. - -..Safely? **TODO** +The `addSafe` call, in comparison to `add`, will only add the multiaddr to +`multiaddrs` if the same multiaddr tries to be added twice. + +This is a simple mechanism to prevent `multiaddrs` from becoming bloated with +unusable addresses, which happens when we exchange observed multiaddrs with +peers which will not provide a useful multiaddr to be shared to the rest of the +network (e.g. a multiaddr referring to a peer inside a LAN being shared to the +outside world). ## peer.multiaddr.rm(addr)