Commit Graph
159 Commits
Author SHA1 Message Date
rade d1400bc233 Merge pull request #407 from awh/369_name_weave_peers
nicknames for weave peers

Closes #369.
2015-02-25 18:10:36 +00:00
rade 47ef9ff85e Merge pull request #413 from awh/373_detect_udp_connectivity_breakage
Tear down connections on prolonged loss of UDP heartbeat.

Closes #373.
2015-02-25 18:09:05 +00:00
Matthias Radestock 62c6242840 remove dead code 2015-02-25 17:13:52 +00:00
rade eafe17255b Merge pull request #421 from bboreham/418_copy_connections
Avoid some deadlocks

Fixes #418
2015-02-25 16:23:05 +00:00
Bryan Boreham 607b528973 Copy connections before sending, to avoid a deadlock 2015-02-25 16:11:58 +00:00
Michael Bridgen 0e4b33b103 Merge branch 'json_status' of https://github.com/bboreham/weave into pr359 2015-02-25 14:46:33 +00:00
Adam Harrison 25c0cfd0c4 Actually use empty string as test nickname 2015-02-25 12:10:56 +00:00
Adam Harrison 72c9ae7a5c Use empty string as test nickname 2015-02-24 22:25:46 +00:00
Adam Harrison cd168f54b2 Removed obsolete constant 2015-02-24 19:42:18 +00:00
Adam Harrison d031e8d246 Merge branch 'master' into 373_detect_udp_connectivity_breakage
Conflicts:
	router/connection.go
2015-02-24 18:53:39 +00:00
Adam Harrison 7618ae033c Simplify to single heartbeat timer 2015-02-24 18:31:18 +00:00
Bryan Boreham 78d2a3e466 Add 'finished' chan to stop callers blocking on closed connection 2015-02-24 10:48:52 +00:00
Adam Harrison 0a0ed7a871 Tear down connections on prolonged loss of UDP heartbeat 2015-02-23 15:29:11 +00:00
Adam Harrison 244af11701 Rename hostname to nickname
Accept -nickname parameter to weave script
2015-02-19 17:09:08 +00:00
Adam Harrison 8f6a525bde Bump protocol version due to introduction of hostname field 2015-02-19 14:42:26 +00:00
Adam Harrison 1707244725 Include remote hostname for connections in router status 2015-02-19 13:34:01 +00:00
Adam Harrison f517b947e6 Add hostname to peers 2015-02-19 12:29:37 +00:00
Bryan Boreham 410972906b Add version and encryption status into the JSON output 2015-02-06 17:35:39 +00:00
Matthias Radestock e2818f883c refactor: move and simplify handshake logic 2015-02-04 16:49:57 +00:00
Matthias Radestock 9c3d509b10 cosmetics
suggested by linter
2015-02-03 14:46:35 +00:00
Bryan Boreham e600816d5f Add UID and version into JSON for each Peer 2015-02-02 14:41:49 +00:00
Matthias Radestock ed65023021 only include established connections in route calculation
except for reachability analysis in gc
2015-02-01 19:13:51 +00:00
Matthias Radestock 7834057b2e cosmetic: remove duplicate comment 2015-02-01 17:52:07 +00:00
Matthias Radestock f25696c245 prevent premature gc of peers from topology
Topology gossip can be received on a connection before that connection
has been marked as 'established'. If we do not include unestablished
connections in topology gossip, then parts of the topology can be
removed by gc, since they are deemed unreachable, which can cause
subsequent incremental topology gossips to be rejected due to them
containing references to peers that have been removed by the gc.

Including unestablished connections in topology gossip requires:

- removing the check for 'established' connections in the encoding of
  peers for topology gossip,
- adding the 'established' flag to the internal representation of
  remote connections,
- adding the 'established' flag to to encoding of connections in
  topology gossip,
- treating the *addition* of a connection as an update to the local
  peer.

The latter entails

- bumping the peer version on connection addition (as well as on
  marking 'established' as previously),
- bumping the peer version *unconditionally* on connection deletion
  (rather than only when the connection was 'established', as
  previously),
- moving the initial sending of complete topology on the connection,
  and the broadcasting of a topology update containing the two peers
  at the ends of the connection, from the connection 'established'
  logic to the connection addition logic,
- broadcasting just an topology update for the local peer when a
  connection gets marked as 'established',
- broadcasting a topology update for the local peer *unconditionally*
  when a connection is removed (rather than only doing this when the
  connection was 'established', as previously).
2015-02-01 16:52:39 +00:00
Matthias Radestock b43e5debb1 gofmt 2015-02-01 16:50:43 +00:00
Matthias Radestock 2d135f3da0 prevent premature peer gc
Caused by a race between adding the connection to our map and
receiving a topology gossip on it.

We remove the race by making AddConnection synchronous and invoking it
prior to entering the tcp receive loop.

Fixes #367.
2015-01-31 22:29:07 +00:00
Matthias Radestock 8f18df7a43 cosmetic: improve comment 2015-01-31 11:38:29 +00:00
Matthias Radestock 2dee5abccc cosmetic 2015-01-31 11:35:46 +00:00
Matthias Radestock 65d0c8b4ce log unknown peer received in topology gossip 2015-01-31 11:31:45 +00:00
Matthias Radestock de45a85162 tweak error handling in topology update application
- simplify
- abort early
2015-01-31 10:35:36 +00:00
Matthias Radestock c1dd2e3a09 tear down connections that have no (initial) udp connectivity
Prior to the introduction of gossip, a tcp connection would not see
regular communication until it had been marked as 'established',
because the topology communication scheme would periodically send
'FetchAll' only after that. So in the absence of udp connectivity we'd
time out. The timeout could of course occur for other reasons, namely
disrupted tcp connectivity, but the combination of a timeout and 'not
established' pointed to a lack of udp connectivity as a likely
cause. So that's what we checked for.

In the new gossip-based topology communication, however, gossip (of
anything, not just topology) occurs as soon as we have tcp
connectivity. Therefore we will no longer encounter a timeout when
just udp connectivity is disrupted. Which makes our check invalid.

So instead we introduce a one-shot timer, created on handshake
completion and cancelled when we mark the connection as
'established'. When the timer fires, and the connection still hasn't
been established, we shut down the connection with an error indicating
lack of udp connectivity.
2015-01-29 12:41:52 +00:00
Matthias Radestock 17f6653cae cosmetic: var name consistency with Routes.calculateBroadcast 2015-01-27 20:53:56 +00:00
Matthias Radestock d88c12caa7 improve peer gc efficiency
Instead of separately calculating routes to every individual peer,
carry out one calculation for routes to all peers. Same as unicast
routes except taking into account asymmetric connections.
2015-01-27 20:33:13 +00:00
Matthias Radestock 6c934f1cd3 cosmetic: reorder some LocalPeer methods to match typical lifecycle 2015-01-27 18:11:42 +00:00
Bryan Boreham 4647c36a15 Unit tests for gossip-based topology communication 2015-01-27 12:45:40 +00:00
Bryan Boreham 5dc9b085a0 Replace previous topology communication with gossip-based mechanism 2015-01-27 12:45:40 +00:00
Bryan Boreham 18df01a4bf Basic gossip implementation 2015-01-27 12:45:40 +00:00
Bryan Boreham c80bff473f Simplify DeleteTestConnection along the same lines as AddTestConnection 2015-01-26 14:03:32 +00:00
Matthias Radestock 824286d382 shrink "improved" topology update
When an update contains an older version of a peer we know about,
there is no point in including our better version in the "improved"
update, since we will have told our neighbours about that already and
any race conditions are taken care off by the periodic sending of the
complete topology.
2015-01-25 12:27:45 +00:00
Matthias Radestock 13fc0bf720 add some tests for Peers
extracted from #313
2015-01-24 10:56:44 +00:00
Matthias Radestock b137f3b639 oops 2015-01-24 10:37:03 +00:00
Matthias Radestock 55f55a59bc refactor: promote connection lifecycle methods from LocalPeer to Peer
They are sufficiently generic, and having them on Peer is useful for
testing.
2015-01-23 20:04:09 +00:00
Matthias Radestock 4cb306e714 refactor: eliminate dependency of Peers on MacCache 2015-01-23 16:24:41 +00:00
Matthias Radestock 3baa3c09a4 revamp error handling on tcp connection receive loop
- treat crypto decoding errors as errors instead of warnings
- introduce helper for handling protocol messages
- put conn.Shutdown in one place
2015-01-22 16:21:48 +00:00
Matthias Radestock 6253be6ecf cosmetic: nuke stray whitespace 2015-01-22 14:49:00 +00:00
Matthias Radestock 8af2a1c25d refactor: make tie breaking part of the Connection interface
and thus eliminate all knowledge of LocalConnection from the
LocalPeer.handle* methods
2015-01-21 21:44:22 +00:00
Matthias Radestock 99525ebf85 refactor: LocalConnection.CheckFatal be gone!
use Shutdown instead, which is in the Connection interface, thus
further reducing dependency on LocalConnection.
2015-01-21 21:23:59 +00:00
Bryan Boreham c7af02776f Obtain status info in JSON format 2015-01-21 21:03:16 +00:00
Matthias Radestock 9a27299562 cosmetic: consistent method order 2015-01-21 20:55:51 +00:00
Matthias Radestock fe07a41dc3 refactor: make LocalConnection uid 'private'
which makes sense now that we've abstracted tie breaking
2015-01-21 20:46:45 +00:00