mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2025-07-03 08:27:47 +00:00
fix core_test.go and a race in setting/using mtu
This commit is contained in:
@ -243,16 +243,20 @@ func (c *Core) MaxMTU() uint64 {
|
||||
return c.store.maxSessionMTU()
|
||||
}
|
||||
|
||||
// SetMTU can only safely be called after Init and before Start.
|
||||
func (c *Core) SetMTU(mtu uint64) {
|
||||
if mtu < 1280 {
|
||||
mtu = 1280
|
||||
}
|
||||
c.store.mutex.Lock()
|
||||
c.store.mtu = mtu
|
||||
c.store.mutex.Unlock()
|
||||
}
|
||||
|
||||
func (c *Core) MTU() uint64 {
|
||||
return c.store.mtu
|
||||
c.store.mutex.Lock()
|
||||
mtu := c.store.mtu
|
||||
c.store.mutex.Unlock()
|
||||
return mtu
|
||||
}
|
||||
|
||||
// Implement io.ReadWriteCloser
|
||||
|
Reference in New Issue
Block a user