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
Matthias Radestock
74b3f8d44e
use map[...]struct{} for sets instead of map[...]bool
...
See https://groups.google.com/d/msg/golang-nuts/lb4xLHq7wug/MhrSLkyS4F8J
We don't really care about the performance aspect of this, but using
struct{}{} values is in some way canonical since it means the
representation carries no redundant information.
2015-04-06 11:35:11 +01:00
Matthias Radestock
624373ace2
simplify
2015-04-05 17:03:18 +01:00
Matthias Radestock
8c1015d2a4
cosmetic: consistent terminology in var names
2015-04-04 22:18:31 +01:00
Matthias Radestock
95c1e226f0
use routes based on tcp overlay connectivity for gossip
...
i.e. include asymmetric and non-established connections
This is TRTTD since gossip flows over the tcp overlay.
2015-04-04 21:56:30 +01:00
Matthias Radestock
3fba123bc0
comment
2015-04-04 21:14:25 +01:00
Matthias Radestock
b272dcf8c1
rename: less 'gossip' in gossip
2015-04-04 20:58:10 +01:00
Matthias Radestock
91ed22a953
refactor(ish): generalise an abstraction
...
LocalPeer.NextBroadcastHops -> ConnectionsTo
thus separating the computation of who we want to connect to from
obtaining the associated Connections
2015-04-04 20:36:48 +01:00
Matthias Radestock
bcd2a0184c
small refactor
2015-04-04 20:08:38 +01:00
Matthias Radestock
45fd750318
cosmetic: move some test helpers from test code into main code
...
since they reach quite deeply into the data structures
2015-04-04 20:02:22 +01:00
Matthias Radestock
0a02d1a926
cosmetic: rename a type
2015-04-04 20:02:01 +01:00
Matthias Radestock
ac0788cb5a
simplify test router creation
2015-04-04 19:50:19 +01:00
Matthias Radestock
683caef866
tweak comment
2015-04-04 19:46:47 +01:00
Matthias Radestock
fa5279ab3e
cosmetic
2015-04-04 16:02:01 +01:00
Matthias Radestock
6cda74d49f
refactor: inline
2015-04-04 15:36:42 +01:00
Matthias Radestock
fdea7d93f9
refactor: improve abstraction in connection gossip handling
...
- turn previously free-floating functions into methods on GossipChannel
- move gossip message type dispatch from connection into router
2015-04-03 19:38:01 +01:00
Matthias Radestock
6f398a7459
refactor(ish): raise GossipSender abstraction level slightly
2015-04-03 18:33:59 +01:00
Matthias Radestock
7166d151aa
make route calculcation more efficient and properly async
...
Instead of following the usual actor pattern, we use a 1-place channel
with a non-blocking send. Essentially, if there is already a pending
recalculation request queued up, there is no point enqueuing another
one.
2015-04-03 18:12:03 +01:00
David Wragg
587a67d701
Comment
...
It's not blindingly obvious where this 'found' comes from.
2015-04-02 16:37:30 +01:00
Matthias Radestock
5648f87717
oops
...
broke this in 45740b1419
2015-04-02 13:03:42 +01:00
Matthias Radestock
e97a3f88aa
allow router to be started w/o capture/inject interface
...
useful for testing of the control plane
2015-04-02 09:46:29 +01:00
Matthias Radestock
e33d2eaf8e
cosmetic
2015-04-02 07:10:21 +01:00
Matthias Radestock
b50688b4de
act immediately on weave connecting existing addresses
...
we simply reset the vars controlling backoff for that address
Note that we do not interrupt any current connection attempt, since
that is hard.
Closes #499 .
2015-03-31 11:05:11 +01:00
David Wragg
b00be096f7
Fix returns when iterating over Connections()
...
d5eb76f32 replaced (*Peer)ForEachConnection into (*Peer)Connections(),
and consequently converted some nested functions into for loops. But
the "return" statements in those nested functions were left as-was,
and so exited the outer function rather than moving on to the next
iteration.
Fixes #497
2015-03-29 19:10:44 +01:00
Matthias Radestock
d708cb7d4e
prevent PMTUVerfied handling from blocking
...
...due to blocking on sending the pmtu to the forwarder, because the
forwarder has terminated.
Fixes #464 .
2015-03-29 14:04:28 +01:00
Matthias Radestock
fc22f9664e
refactor: improve encapsulation of Forwarder
2015-03-29 12:14:32 +01:00
Matthias Radestock
07c11d87a8
oops
...
I broke this in 1eca5e1097
2015-03-29 12:11:59 +01:00
Matthias Radestock
4eda7e361b
put back forwarder channel nil check
...
since otherwise forward(...) can block indefinitely due to both the
forwarder channel and finshed channel being nil
2015-03-29 10:36:01 +01:00
Matthias Radestock
b6448fa196
more idiomatic closing of forwarders, by closing a 'finished' channel
...
The previous scheme set the reference to main channel to nil and then
drained it. That was racy and hence could lead to deadlock in the
following scenario:
1. multiple senders obtain the main channel from the stored reference
2. main channel reference is set to nil
3. main channel is drained
4. multiple senders send to main channel
So the issue here is that the entire forwarder stopping sequence
occurs between senders obtaining of the reference to the main channel,
and then sending on that channel. If more senders sent than there is
capacity in the channel then this leads to deadlock.
2015-03-28 20:58:42 +00:00
Matthias Radestock
4dbb3d97e0
cosmetic: remove dead code
2015-03-28 20:33:06 +00:00
Matthias Radestock
502b59c703
refactor: rename
2015-03-28 19:52:10 +00:00
Matthias Radestock
9a462f9d87
refactor: simplify NewNaClEncryptor
...
- rely on default nil values on initialisation
- inline
2015-03-28 19:49:01 +00:00
Matthias Radestock
9992992ee4
refactor: extract helper from NaClDecryptor.decrypt
...
for easier comprehension
2015-03-28 19:44:04 +00:00
David Wragg
78c70023d8
Don't pass the sender UDPAddr through the crypto layer
...
The crypto layer doesn't need it, and the cost of an additional
closure allocation for each incoming UDP packet is modest.
Also, make the FrameConsumer the last parameter to IterateFrames.
It seems a more natural ordering.
2015-03-27 18:05:00 +00:00
David Wragg
0d30df165f
Eliminate UDPPacket
...
The Name field is not used anywhere, and once that's gone the remaining
pairing of the packet bytes and sender is not worth it.
2015-03-27 18:05:00 +00:00
David Wragg
4a1d3aeb96
Remove frameLen parameter to FrameConsumer
...
It's the same as len(frame)
2015-03-27 18:05:00 +00:00
David Wragg
bc45a363dd
Make Encryptor.AppendFrame more consistent with FrameConsumer
...
Also removes references to Peer type in crypto.go, to keep it agnostic
of higher-level concerns.
2015-03-27 18:05:00 +00:00
David Wragg
a670272a37
Remove name parameter from (*Peers)ForEach consumer function
...
It's part of the Peer anyway.
2015-03-27 18:05:00 +00:00
Matthias Radestock
a337e981ba
refactor: extract helper
2015-03-27 12:38:06 +00:00
Matthias Radestock
0ef717a7a2
refactor: extract helper function
2015-03-27 12:31:25 +00:00
Matthias Radestock
d25d295784
refactor: small tweak for consistency
2015-03-27 12:17:28 +00:00
Matthias Radestock
60ba8cb90d
refactor: extract helper function
2015-03-27 12:06:22 +00:00
Matthias Radestock
4d8c156915
continuing accumulation after dropping a frame is bad after all
...
explain why
2015-03-27 11:56:38 +00:00
Matthias Radestock
6ea625f85b
fix typo
2015-03-27 11:54:24 +00:00
Matthias Radestock
84a95f2daf
refactor: concentrate frame appending code in one place
2015-03-27 11:53:56 +00:00
Matthias Radestock
f544fc68de
enter frame accumulation even after dropping one
...
This logically makes more sense, i.e. we keep draining frames from
fwd.ch until we run out.
2015-03-27 11:35:42 +00:00