Commit Graph
296 Commits
Author SHA1 Message Date
David Wragg dceef04ffa Separate Forwarder and ForwarderDF
Much of the state and code associated with Forwarder only applied in the
DF case.
2015-04-18 10:38:05 +01:00
Matthias Radestock a5a91ebb33 do not shut down connections on PacketDecodingError 2015-04-15 21:52:56 +01:00
Matthias Radestock f4ba0f7287 log udp packet processing errors against the connection 2015-04-15 21:10:22 +01:00
Matthias Radestock 57b7276ceb create forwarders before AddConnection, if we can
This is beneficial for reasons explained in the comments. And we used
to do that previously, when initHeartbeats was called before
AddConnection.
2015-04-15 20:55:42 +01:00
Matthias Radestock 9b25815641 don't send heartbeats on new but ultimately invalid connections
It is wasteful and can trip up crypto at the other end. See comment
for why.

To accomplish this we move the responsibility for shutting down the
new, invalid connection from LocalPeer.AddConnection to its caller,
i.e. LocalConnection.run. So rather than always firing up all the
connection machinery and getting told asynchronously by AddConnection
to shut it all down again, we now only fire it up if AddConnection
succeeded.
2015-04-15 20:04:40 +01:00
Matthias Radestock a9963675b6 remove dead code 2015-04-15 16:13:18 +01:00
Matthias Radestock 339f85cbcb get rid of Router.NormalisePeerAddr
There was only one call site left and it always gets invoked with an
ip:port, so normalisation is a no-op.

Also remove mysterious comment.
2015-04-15 11:44:48 +01:00
Matthias Radestock 290d5443cc more discriminate connectivity
If a peer was specified on the command line w/o a port, then do not
connect to it if we have inbound connections from that IP.

This eliminates unnecessary (and ultimately failing) connection
attempts in the common scenario of several peers having been told
about each other on their command lines.

We represent a command line peer address with a TCPAddr, which avoids
back and forth conversion to string and extra fields to carry the "did
the original include a port?" information.
2015-04-15 11:42:53 +01:00
Matthias Radestock 5415e3a60a drop "Peer " prefix in Peers section of status
it's redundant and the output looks much better w/o it
2015-04-15 11:09:35 +01:00
Matthias Radestock f0998d6196 declutter status' reconnects section 2015-04-15 10:56:29 +01:00
Matthias Radestock f6def13ea9 change style for connections in status' reconnects section
to match how they are shown in the logs
2015-04-15 10:55:14 +01:00
Matthias Radestock b1fd1334b4 always include the remote address in connection log entries
in addition to the peer name

This is handy for debugging, especially in situations when there are
multiple connections in flight to the same peer.
2015-04-14 22:14:29 +01:00
Matthias Radestock 31775a8b84 cosmetic 2015-04-14 17:58:13 +01:00
Matthias Radestock 973996184d fix bug 2015-04-14 13:27:10 +01:00
Matthias Radestock 798bfeb0a7 make the Router include the RouterConfig
rather than copying the bulk of it
2015-04-14 11:39:11 +01:00
Matthias Radestock 961801b792 refactor: shrink function by extracting helpers 2015-04-14 06:49:47 +01:00
Matthias Radestock c2972b7558 cosmetic: remove dead code 2015-04-13 21:28:07 +01:00
Matthias Radestock b062facbe9 refactor: inline 2015-04-13 15:56:52 +01:00
rade a80b8eacac Merge pull request #552 from bboreham/status-conn-errors
Allow ConnectionMaker to report the reason the connection broke
2015-04-13 15:46:09 +01:00
Matthias Radestock 8ab14ea1c6 don't crash
this got broken in a93a09dd35
2015-04-13 15:37:44 +01:00
Matthias Radestock 3db4e86564 remove established connections from ConnectionMaker state
This got broken in 6409a8647c
The issue is that for successful connections nothing ever sets
attempting=false, so we need some other means of removing such
entries.
2015-04-13 14:59:32 +01:00
Bryan Boreham 8ad244e0f9 Let ConnectionMaker report the reason the connection broke 2015-04-13 14:35:27 +01:00
Bryan Boreham f8ec56ea79 Move connection shutdown logging into shutdown() 2015-04-13 14:21:11 +01:00
Matthias Radestock a93a09dd35 remember user-supplied peer addresses as given
rather than post name resolution. This way we can forget them as given
even when name resolution has changed or fails.
2015-04-12 20:44:12 +01:00
Matthias Radestock 1275bb24e5 exclude stale info from ConnectionMaker.String()
This got broken in 7bd0f7dbae.
2015-04-12 12:23:32 +01:00
Matthias Radestock 6409a8647c simplify connection logic slightly
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.
2015-04-12 12:11:27 +01:00
Matthias Radestock 21102d3615 refactor: extract router configuration
the param list of NewRouter was getting a bit long
2015-04-12 10:46:46 +01:00
Matthias Radestock e89e3adc69 cosmetic: more consistent param/arg/var ordering re Port 2015-04-12 10:45:49 +01:00
Bryan Boreham d228a4450a Make sure FieldValidator methods act on the object we pass in.
Added a unit test for FieldValidator
2015-04-10 22:42:40 +01:00
Matthias Radestock d19d485d39 refactor: make LocalPeer.Router "private"
nothing outside LocalPeer should access it
2015-04-10 21:56:00 +01:00
David Wragg 7d51f8751b gofmt 2015-04-10 20:55:27 +01:00
rade bd8cb02f17 Merge pull request #534 from abligh/select-ports-on-cli
Add options to set ports on weaver command line
2015-04-10 13:54:41 +01:00
Alex Bligh 12d88eac23 Add options to set ports on weaver command line
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>
2015-04-10 12:09:13 +01:00
Matthias Radestock f3d20111d8 eliminate dependency on LocalPeer.Router
(from things outside LocalPeer)
2015-04-10 10:51:40 +01:00
Bryan Boreham 2ba8f34132 Merge pull request #521 from rade/517_lower_topology_periodic_gossip_complexity
LGTM.  Closes #517
2015-04-10 10:08:23 +01:00
David Wragg bb9e26b4ae Merge pull request #528 from 'bboreham/name_change' 2015-04-10 08:03:38 +01:00
Matthias Radestock 12c97b4fc5 topology-sensitive random selection of gossip neighbours 2015-04-09 18:10:57 +01:00
Matthias Radestock f5362289cf switch to a more efficient GC for gossip senders 2015-04-09 11:44:13 +01:00
Matthias Radestock 40d127d9a4 make connection heartbeating independent of periodic gossip
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.
2015-04-09 11:44:13 +01:00
Matthias Radestock e639007b62 eliminate AddConnection/RemoveConnection race
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.
2015-04-09 06:34:35 +01:00
Matthias Radestock 56f5c749e1 optimise broadcast route calculation
...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.
2015-04-08 21:54:45 +01:00
Bryan Boreham 8a82f368d0 Update repository name from zettio to weaveworks 2015-04-08 16:35:52 +01:00
Matthias Radestock f80410bf59 switch to gossip broadcast for topology updates 2015-04-06 14:17:23 +01:00
Matthias Radestock f4416bfadc introduce Routes.EnsureRecalculated
A means to ensure that any preceeding route recalculation requests
have been processed. It's akin to a global promise.
2015-04-06 14:17:23 +01:00
Matthias Radestock 6bc660068f use GossipSender for GossipBroadcast
This makes GossipBroadcast properly async.
2015-04-06 14:17:23 +01:00
Matthias Radestock 8a2828d57d add "representation of received update" to return of Peers.ApplyUpdate 2015-04-06 14:17:23 +01:00
Matthias Radestock a58eb6ba7d make gossip broadcast operate on GossipData 2015-04-06 14:00:51 +01:00
Matthias Radestock 9b9d8a03aa refactor: make Peer.Connections() return a set instead of a slice
This is more flexible since it allows callers to perform efficient
lookups on the result.
2015-04-06 13:57:13 +01:00
Matthias Radestock e8e9a43abd tired of typing "struct{}{}" 2015-04-06 11:53:51 +01:00
Matthias Radestock 6db12d682e make PeerNameSet a more broadly used type 2015-04-06 11:45:17 +01:00