Move TCP under link.go

This commit is contained in:
Neil Alexander 2019-03-04 17:09:48 +00:00
parent ddd1ac4606
commit ae79246a66
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
5 changed files with 30 additions and 29 deletions

View file

@ -8,6 +8,7 @@ import (
"net"
"strings"
"sync"
//"sync/atomic"
"time"
@ -20,7 +21,8 @@ type link struct {
core *Core
mutex sync.RWMutex // protects interfaces below
interfaces map[linkInfo]*linkInterface
awdl awdl // AWDL interface support
awdl awdl // AWDL interface support
tcp tcpInterface // TCP interface support
// TODO timeout (to remove from switch), read from config.ReadTimeout
}
@ -58,6 +60,11 @@ func (l *link) init(c *Core) error {
l.interfaces = make(map[linkInfo]*linkInterface)
l.mutex.Unlock()
if err := l.tcp.init(l); err != nil {
c.log.Errorln("Failed to start TCP interface")
return err
}
if err := l.awdl.init(l); err != nil {
l.core.log.Errorln("Failed to start AWDL interface")
return err