refactor: separate MacCache creation from activation

This commit is contained in:
Matthias Radestock committed 2015-01-19 16:45:06 +00:00
1 parent 1a85990bdc
commit 24bd0a9a75
2 files changed
+13 -10

No files matched your search

+5 -3
View File
@@ -22,12 +22,14 @@ type MacCache struct {
}
func NewMacCache(maxAge time.Duration, onExpiry func(net.HardwareAddr, *Peer)) *MacCache {
res := &MacCache{
return &MacCache{
table: make(map[uint64]*MacCacheEntry),
maxAge: maxAge,
onExpiry: onExpiry}
res.setExpiryTimer()
return res
}
func (cache *MacCache) Start() {
cache.setExpiryTimer()
}
func (cache *MacCache) Enter(mac net.HardwareAddr, peer *Peer) bool {