diff --git a/router/connection.go b/router/connection.go index b78d2e74..9cfaac86 100644 --- a/router/connection.go +++ b/router/connection.go @@ -131,7 +131,7 @@ const ( func (conn *LocalConnection) Shutdown(err error) { conn.queryChan <- &ConnectionInteraction{ Interaction: Interaction{code: CShutdown}, - payload: err} + payload: err} } // Async @@ -176,7 +176,7 @@ func (conn *LocalConnection) run(queryChan <-chan *ConnectionInteraction, accept } log.Printf("->[%s] completed handshake with %s\n", conn.remoteTCPAddr, conn.remote.Name) - heartbeatFrameBytes := make([]byte, EthernetOverhead + 8) + heartbeatFrameBytes := make([]byte, EthernetOverhead+8) binary.BigEndian.PutUint64(heartbeatFrameBytes[EthernetOverhead:], conn.UID) conn.heartbeatFrame = &ForwardedFrame{ srcPeer: conn.local, @@ -550,12 +550,11 @@ func (conn *LocalConnection) extendReadDeadline() { conn.TCPConn.SetReadDeadline(time.Now().Add(ReadTimeout)) } - func (conn *LocalConnection) sendFastHeartbeats() error { err := conn.ensureForwarders() if err == nil { conn.heartbeat = time.NewTicker(FastHeartbeat) - conn.Forward(true, conn.heartbeatFrame, nil) // avoid initial wait + conn.Forward(true, conn.heartbeatFrame, nil) // avoid initial wait } return err } diff --git a/router/router.go b/router/router.go index aa0f05d7..fa0ca37e 100644 --- a/router/router.go +++ b/router/router.go @@ -265,7 +265,7 @@ func (router *Router) handleUDPPacketFunc(dec *EthernetDecoder, po PacketSink) F return nil } switch { - case frameLen == EthernetOverhead + 8: + case frameLen == EthernetOverhead+8: relayConn.ReceivedHeartbeat(sender, binary.BigEndian.Uint64(frame[EthernetOverhead:])) case frameLen == FragTestSize && bytes.Equal(frame, FragTest): relayConn.SendTCP(ProtocolFragmentationReceivedByte)