diff --git a/router/connection.go b/router/connection.go index a22eeb27..fe9073d3 100644 --- a/router/connection.go +++ b/router/connection.go @@ -486,13 +486,14 @@ func (conn *LocalConnection) receiveTCP(decoder *gob.Decoder, usingPassword bool // request full update conn.SendTCP(ProtocolFetchAllByte) continue - } else if conn.CheckFatal(err) != nil { + } + if conn.CheckFatal(err) != nil { return } - if len(newUpdate) == 0 { - continue + if len(newUpdate) != 0 { + conn.Router.Topology.RebuildRoutes() + conn.local.BroadcastTCP(Concat(ProtocolUpdateByte, newUpdate)) } - conn.local.BroadcastTCP(Concat(ProtocolUpdateByte, newUpdate)) } else if msg[0] == ProtocolPMTUVerified { conn.verifyPMTU <- int(binary.BigEndian.Uint16(msg[1:])) } else { diff --git a/router/peer.go b/router/peer.go index 684a4eb2..b27e621d 100644 --- a/router/peer.go +++ b/router/peer.go @@ -389,13 +389,13 @@ func (peer *Peer) handleConnectionEstablished(conn *LocalConnection) { } func (peer *Peer) handleBroadcastTCP(msg []byte) { - peer.Router.Topology.RebuildRoutes() peer.ForEachConnection(func(_ PeerName, conn Connection) { conn.(*LocalConnection).SendTCP(msg) }) } func (peer *Peer) broadcastPeerUpdate(peers ...*Peer) { + peer.Router.Topology.RebuildRoutes() peer.handleBroadcastTCP(Concat(ProtocolUpdateByte, EncodePeers(append(peers, peer)...))) } diff --git a/site/how-it-works.md b/site/how-it-works.md index 535f7a75..c67fad48 100644 --- a/site/how-it-works.md +++ b/site/how-it-works.md @@ -5,6 +5,19 @@ layout: default ## How does it work? +A weave network consists of a number of 'peers' - weave routers +residing on different hosts. Each peer has a name, which tends to +remain the same over restarts, and a unique identifier (UID) which is +different each time it is run. These are opaque identifiers as far as +the router is concerned, although the name defaults to a MAC address. + +Weave routers establish TCP connections to each other, over which they +perform a protocol handshake and subsequently exchange topology +information (see below). These connections are encrypted if so +configured. Peers also establish UDP "connections", possibly +encrypted, which carry encapsulated network packets. These +"connections" are duplex and can traverse firewalls. + Weave creates a network bridge on the host. Each container is connected to that bridge via a veth pair, the container side of which is given the IP address & netmask supplied in 'weave run'. Also @@ -26,13 +39,6 @@ peer. The topology information captures which peers are connected to which other peers; weave can route packets in partially connected networks with changing topology. -Weave routers establish TCP connections to each other, over which they -perform a protocol handshake and subsequently exchange topology -information. These connections are encrypted if so configured. Peers -also establish UDP "connections", possibly encrypted, for the -aforementioned packet forwarding. These "connections" are duplex and -can traverse firewalls. - ### Encapsulation When the weave router forwards packets, the encapsulation looks diff --git a/site/troubleshooting.md b/site/troubleshooting.md index 76652fc8..1603b939 100644 --- a/site/troubleshooting.md +++ b/site/troubleshooting.md @@ -83,11 +83,8 @@ Reconnects: The terms used here are explained further at [how it works](how-it-works.html). -A 'peer' on the weave network is a weave router; one per host. Each -peer has a name, which tends to remain the same over restarts, and a -unique identifier (UID) which is different each time it is run. These -are opaque identifiers as far as the router is concerned, although the -name defaults to a MAC address. +The 'Our name' line identifies the local weave router as a peer in the +weave network. The 'Sniffing traffic' line shows details of the virtual ethernet interface that weave is using to receive packets on the local