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 {
|
||||
switch tag {
|
||||
case ProtocolHeartbeat:
|
||||
case ProtocolConnectionEstablished, ProtocolFragmentationReceived, ProtocolPMTUVerified, ProtocolOverlayControlMsg:
|
||||
case ProtocolReserved1, ProtocolReserved2, ProtocolReserved3, ProtocolOverlayControlMsg:
|
||||
conn.OverlayConn.ControlMessage(byte(tag), payload)
|
||||
case ProtocolGossipUnicast, ProtocolGossipBroadcast, ProtocolGossip:
|
||||
return conn.Router.handleGossip(tag, payload)
|
||||
|
||||
+3
-3
@@ -329,9 +329,9 @@ type ProtocolTag byte
|
||||
|
||||
const (
|
||||
ProtocolHeartbeat = iota
|
||||
ProtocolConnectionEstablished
|
||||
ProtocolFragmentationReceived
|
||||
ProtocolPMTUVerified
|
||||
ProtocolReserved1 // legacy overlay control messages
|
||||
ProtocolReserved2 //
|
||||
ProtocolReserved3 //
|
||||
ProtocolGossip
|
||||
ProtocolGossipUnicast
|
||||
ProtocolGossipBroadcast
|
||||
|
||||
+10
-6
@@ -56,6 +56,10 @@ const (
|
||||
FragTestInterval = 5 * time.Minute
|
||||
MTUVerifyAttempts = 8
|
||||
MTUVerifyTimeout = 10 * time.Millisecond // doubled with each attempt
|
||||
|
||||
ProtocolConnectionEstablished = mesh.ProtocolReserved1
|
||||
ProtocolFragmentationReceived = mesh.ProtocolReserved2
|
||||
ProtocolPMTUVerified = mesh.ProtocolReserved3
|
||||
)
|
||||
|
||||
type SleeveOverlay struct {
|
||||
@@ -761,13 +765,13 @@ func (fwd *sleeveForwarder) handleSpecialFrame(special specialFrame) error {
|
||||
|
||||
func (fwd *sleeveForwarder) handleControlMessage(cm controlMessage) error {
|
||||
switch cm.tag {
|
||||
case mesh.ProtocolConnectionEstablished:
|
||||
case ProtocolConnectionEstablished:
|
||||
return fwd.handleHeartbeatAck()
|
||||
|
||||
case mesh.ProtocolFragmentationReceived:
|
||||
case ProtocolFragmentationReceived:
|
||||
return fwd.handleFragTestAck()
|
||||
|
||||
case mesh.ProtocolPMTUVerified:
|
||||
case ProtocolPMTUVerified:
|
||||
return fwd.handleMTUTestAck(cm.msg)
|
||||
|
||||
default:
|
||||
@@ -836,7 +840,7 @@ func (fwd *sleeveForwarder) handleHeartbeat(special specialFrame) error {
|
||||
|
||||
if !fwd.ackedHeartbeat {
|
||||
fwd.ackedHeartbeat = true
|
||||
if err := fwd.sendControlMsg(mesh.ProtocolConnectionEstablished, nil); err != nil {
|
||||
if err := fwd.sendControlMsg(ProtocolConnectionEstablished, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -897,7 +901,7 @@ func (fwd *sleeveForwarder) handleFragTest(frame []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
return fwd.sendControlMsg(mesh.ProtocolFragmentationReceived, nil)
|
||||
return fwd.sendControlMsg(ProtocolFragmentationReceived, nil)
|
||||
}
|
||||
|
||||
func (fwd *sleeveForwarder) handleFragTestAck() error {
|
||||
@@ -943,7 +947,7 @@ func (fwd *sleeveForwarder) sendMTUTest() error {
|
||||
func (fwd *sleeveForwarder) handleMTUTest(frame []byte) error {
|
||||
buf := make([]byte, 2)
|
||||
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 {
|
||||
|
||||
Reference in new issue
Block a user