Unify MTU datatypes across the codebase

The codebase uses int and unit16 to represent MTU randomly. This change
unifies it to a MTU type from types package, which is currently uint16.
This commit is contained in:
Adam Ruzicka 2020-01-05 17:27:54 +00:00
parent 4b16c325a3
commit 8358fe5c5c
13 changed files with 51 additions and 37 deletions

View file

@ -8,10 +8,13 @@ import (
"github.com/yggdrasil-network/yggdrasil-go/src/crypto"
"github.com/yggdrasil-network/yggdrasil-go/src/util"
"github.com/yggdrasil-network/yggdrasil-go/src/types"
"github.com/Arceliar/phony"
)
type MTU = types.MTU
// ConnError implements the net.Error interface
type ConnError struct {
error
@ -65,7 +68,7 @@ type Conn struct {
nodeID *crypto.NodeID
nodeMask *crypto.NodeID
session *sessionInfo
mtu uint16
mtu MTU
readCallback func([]byte)
readBuffer chan []byte
}
@ -93,7 +96,7 @@ func (c *Conn) String() string {
return s
}
func (c *Conn) setMTU(from phony.Actor, mtu uint16) {
func (c *Conn) setMTU(from phony.Actor, mtu MTU) {
c.Act(from, func() { c.mtu = mtu })
}