mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-10-16 09:55:07 +03:00
fix core_test.go and a race in setting/using mtu
This commit is contained in:
parent
cb81be94ec
commit
b34c3230f8
3 changed files with 33 additions and 13 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue