You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
I've come across some practical problems using the HTTP/JSON interface.
What I want to do in essence is replace the current set of peers with a known good set of peers.
Issue 1: I can only add (using /connect) or remove (using /forget) peers, not specify a list of peers replacing the current set. It would be nice if we could do an atomic replace of the peer list with the new peer list, forgetting any that aren't on the new list, and connecting to any new ones. However, you can only add or remove peers one by one.
Issue 2: in order to work around that deficiency, I need to get the list of current peers from weave (using /status-json), parse the JSON (which is a pain), then add or remove the peers as appropriate. There are two sub-issues here: 2A. /status-json does not list the peer IP address and port, so it's impossible to find a given peer. 2B. if the peer has never connected at all (i.e. it's merely configured), it's not listed in /status-json at all; this means that if for example a peer was added which isn't running weave (e.g. is down), it would never get removed. Either that, or /status-json's Peers entry is meant to return only a list of peers that it has negotiated with, in which case it would be very useful to return a list of peers that are configured (perhaps separately).
My current workaround is 'restart weaver' which is not nice.
I think Issue #1 is best addressed through another entry in HandleHTTP which simply takes a comma delimited list of peers and does the appropriate thing. This avoids the need to incorporate a JSON library my end. I suggest a URL of /replace. I'm quite happy to add this myself. However, I'm not entirely sure how to forget a connection that has been initiated but not yet connected - there's a race condition here I think.
I think Issue #2A and #2B are straight bugs. WDYT?
The text was updated successfully, but these errors were encountered:
I've come across some practical problems using the HTTP/JSON interface.
What I want to do in essence is replace the current set of peers with a known good set of peers.
Issue 1: I can only add (using
/connect
) or remove (using/forget
) peers, not specify a list of peers replacing the current set. It would be nice if we could do an atomic replace of the peer list with the new peer list, forgetting any that aren't on the new list, and connecting to any new ones. However, you can only add or remove peers one by one.Issue 2: in order to work around that deficiency, I need to get the list of current peers from weave (using
/status-json
), parse the JSON (which is a pain), then add or remove the peers as appropriate. There are two sub-issues here: 2A./status-json
does not list the peer IP address and port, so it's impossible to find a given peer. 2B. if the peer has never connected at all (i.e. it's merely configured), it's not listed in/status-json
at all; this means that if for example a peer was added which isn't running weave (e.g. is down), it would never get removed. Either that, or/status-json
'sPeers
entry is meant to return only a list of peers that it has negotiated with, in which case it would be very useful to return a list of peers that are configured (perhaps separately).My current workaround is 'restart
weaver
' which is not nice.I think Issue #1 is best addressed through another entry in
HandleHTTP
which simply takes a comma delimited list of peers and does the appropriate thing. This avoids the need to incorporate a JSON library my end. I suggest a URL of/replace
. I'm quite happy to add this myself. However, I'm not entirely sure how to forget a connection that has been initiated but not yet connected - there's a race condition here I think.I think Issue #2A and #2B are straight bugs. WDYT?
The text was updated successfully, but these errors were encountered: