There is no need to remove entries from cm.targets that are in
ourConnectedTargets. None of these targets will be in validTargets
(since addTarget filters anything in ourConnectedTargets), so they
will be removed a few lines further down anyway...
Unless the target is in the 'attempting' state. But that is ok, and in
fact desirable. Any such targets indicate connection attempts that are
in progress, which is something we display in `weave status` and want
to be accurate. Eventually the connection attempt will either succeed
or fail, and the cm.targets entry will be removed on the next run of
connectToTargets.
Implement weaveexec signal proxy
Fixes the following issues with remote (i.e. w/o `--local`) execution of the weave script via a container, as per #507:
1. stderr is merged into stdout
2. line termination with CRLF instead of LF
3. ctrl-c is ignored
Fixes#507. Closes#523.
When running multiple weaver daemons it is convenient for the HTTP
control interface to bind to a UNIX domain socket, to avoid the
need to allocate an additional unique port. This commit adds the
ability to specify
httpaddr="/path/to/socket"
on the command line.
Signed-off-by: Alex Bligh <alex@alex.org.uk>
This issue came to light in the context of `weave launch`. When the
weaver container died after we've completed network configuration, it
would take a minute for the script to terminate, due to `curl` being
stuck in a connection attempt.
Fixes#538.
This commit adds two command line options, intended to allow multiple
instances of weave to run without container separation between them.
* -port=PORT makes weave bind to port PORT (an integer). Without the
option, the default value (6783) is used.
* -httpaddr=ADDRESS makes weave bind its control interface to
a different address. For instance "127.0.0.1:6784" can be used to
bind to localhost only. An absent address element makes it bind to
all interfaces. ":6784" is the default. An empty string
can be used to disable the control interface.
Signed-off-by: Alex Bligh <alex@alex.org.uk>
This was a convenient but rather suspect coupling. In particular, it
will break if the period gossip logic changes s.t. it no longer sends
gossip on all connections every interval.
We were invoking AddConnection in a separate goroutine, and this could
result in RemoveConnection getting invoked first, resulting in bogus
entries in our connection map, which would effectively prevent
connectivity to the other peer until the stale entry got removed
through a lost tie break. And if, per chance, the remote end ran into
exactly the same race condition, then connectivity between that peer
and ourself was broken permanently.
Hitting this race condition required a combination of a) no UDP
heartbeat being received for HeartbeatTimeout(30s) - this causes the
actorLoop to terminate and RemoveConnection to be invoked, and b) the
AddConnection invocation getting delayed for at least that long.
...by obtaining our connection set just once. This also guards against
potential locking issues, since we no longer obtain the required
lock on our local peer while holding a lock on Peers.
Note that this change means the connection list can be out of date by
the time we enter Peers.ForEach. However, previously it was possible
for the list to change for each peer we are iterating over. So it's
just a different flavour of out-of-dateness.