refactor: remove weave overlay-isms from mesh
This commit is contained in:
1 parent
1eed5fd271
commit
64aa2b5cc3
3 files changed
+14
-10
No files matched your search
+1
-1
@@ -422,7 +422,7 @@ func (conn *LocalConnection) receiveTCP(receiver TCPReceiver) {
|
|||||||
func (conn *LocalConnection) handleProtocolMsg(tag ProtocolTag, payload []byte) error {
|
func (conn *LocalConnection) handleProtocolMsg(tag ProtocolTag, payload []byte) error {
|
||||||
switch tag {
|
switch tag {
|
||||||
case ProtocolHeartbeat:
|
case ProtocolHeartbeat:
|
||||||
case ProtocolConnectionEstablished, ProtocolFragmentationReceived, ProtocolPMTUVerified, ProtocolOverlayControlMsg:
|
case ProtocolReserved1, ProtocolReserved2, ProtocolReserved3, ProtocolOverlayControlMsg:
|
||||||
conn.OverlayConn.ControlMessage(byte(tag), payload)
|
conn.OverlayConn.ControlMessage(byte(tag), payload)
|
||||||
case ProtocolGossipUnicast, ProtocolGossipBroadcast, ProtocolGossip:
|
case ProtocolGossipUnicast, ProtocolGossipBroadcast, ProtocolGossip:
|
||||||
return conn.Router.handleGossip(tag, payload)
|
return conn.Router.handleGossip(tag, payload)
|
||||||
|
|||||||
+3
-3
@@ -329,9 +329,9 @@ type ProtocolTag byte
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
ProtocolHeartbeat = iota
|
ProtocolHeartbeat = iota
|
||||||
ProtocolConnectionEstablished
|
ProtocolReserved1 // legacy overlay control messages
|
||||||
ProtocolFragmentationReceived
|
ProtocolReserved2 //
|
||||||
ProtocolPMTUVerified
|
ProtocolReserved3 //
|
||||||
ProtocolGossip
|
ProtocolGossip
|
||||||
ProtocolGossipUnicast
|
ProtocolGossipUnicast
|
||||||
ProtocolGossipBroadcast
|
ProtocolGossipBroadcast
|
||||||
|
|||||||
+10
-6
@@ -56,6 +56,10 @@ const (
|
|||||||
FragTestInterval = 5 * time.Minute
|
FragTestInterval = 5 * time.Minute
|
||||||
MTUVerifyAttempts = 8
|
MTUVerifyAttempts = 8
|
||||||
MTUVerifyTimeout = 10 * time.Millisecond // doubled with each attempt
|
MTUVerifyTimeout = 10 * time.Millisecond // doubled with each attempt
|
||||||
|
|
||||||
|
ProtocolConnectionEstablished = mesh.ProtocolReserved1
|
||||||
|
ProtocolFragmentationReceived = mesh.ProtocolReserved2
|
||||||
|
ProtocolPMTUVerified = mesh.ProtocolReserved3
|
||||||
)
|
)
|
||||||
|
|
||||||
type SleeveOverlay struct {
|
type SleeveOverlay struct {
|
||||||
@@ -761,13 +765,13 @@ func (fwd *sleeveForwarder) handleSpecialFrame(special specialFrame) error {
|
|||||||
|
|
||||||
func (fwd *sleeveForwarder) handleControlMessage(cm controlMessage) error {
|
func (fwd *sleeveForwarder) handleControlMessage(cm controlMessage) error {
|
||||||
switch cm.tag {
|
switch cm.tag {
|
||||||
case mesh.ProtocolConnectionEstablished:
|
case ProtocolConnectionEstablished:
|
||||||
return fwd.handleHeartbeatAck()
|
return fwd.handleHeartbeatAck()
|
||||||
|
|
||||||
case mesh.ProtocolFragmentationReceived:
|
case ProtocolFragmentationReceived:
|
||||||
return fwd.handleFragTestAck()
|
return fwd.handleFragTestAck()
|
||||||
|
|
||||||
case mesh.ProtocolPMTUVerified:
|
case ProtocolPMTUVerified:
|
||||||
return fwd.handleMTUTestAck(cm.msg)
|
return fwd.handleMTUTestAck(cm.msg)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -836,7 +840,7 @@ func (fwd *sleeveForwarder) handleHeartbeat(special specialFrame) error {
|
|||||||
|
|
||||||
if !fwd.ackedHeartbeat {
|
if !fwd.ackedHeartbeat {
|
||||||
fwd.ackedHeartbeat = true
|
fwd.ackedHeartbeat = true
|
||||||
if err := fwd.sendControlMsg(mesh.ProtocolConnectionEstablished, nil); err != nil {
|
if err := fwd.sendControlMsg(ProtocolConnectionEstablished, nil); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -897,7 +901,7 @@ func (fwd *sleeveForwarder) handleFragTest(frame []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return fwd.sendControlMsg(mesh.ProtocolFragmentationReceived, nil)
|
return fwd.sendControlMsg(ProtocolFragmentationReceived, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fwd *sleeveForwarder) handleFragTestAck() error {
|
func (fwd *sleeveForwarder) handleFragTestAck() error {
|
||||||
@@ -943,7 +947,7 @@ func (fwd *sleeveForwarder) sendMTUTest() error {
|
|||||||
func (fwd *sleeveForwarder) handleMTUTest(frame []byte) error {
|
func (fwd *sleeveForwarder) handleMTUTest(frame []byte) error {
|
||||||
buf := make([]byte, 2)
|
buf := make([]byte, 2)
|
||||||
binary.BigEndian.PutUint16(buf, uint16(len(frame)-EthernetOverhead))
|
binary.BigEndian.PutUint16(buf, uint16(len(frame)-EthernetOverhead))
|
||||||
return fwd.sendControlMsg(mesh.ProtocolPMTUVerified, buf)
|
return fwd.sendControlMsg(ProtocolPMTUVerified, buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fwd *sleeveForwarder) handleMTUTestAck(msg []byte) error {
|
func (fwd *sleeveForwarder) handleMTUTestAck(msg []byte) error {
|
||||||
|
|||||||
Reference in new issue
Block a user