strip a couple things

This commit is contained in:
Asim Aslam 2019-12-12 21:49:39 +00:00
parent 7bd50cd251
commit 74c5102e41
2 changed files with 6 additions and 12 deletions

View File

@ -773,9 +773,6 @@ func (n *network) processNetChan(listener tunnel.Listener) {
log.Debugf("Network failed to advertise peers: %v", err) log.Debugf("Network failed to advertise peers: %v", err)
} }
// wait for a second
<-time.After(time.Second)
// advertise all the routes when a new node has connected // advertise all the routes when a new node has connected
if err := n.router.Solicit(); err != nil { if err := n.router.Solicit(); err != nil {
log.Debugf("Network failed to solicit routes: %s", err) log.Debugf("Network failed to solicit routes: %s", err)

View File

@ -375,8 +375,8 @@ func (t *tun) process() {
<-t.updated <-t.updated
// get the list of links // get the list of links
t.RLock()
var links []*link var links []*link
t.RLock()
for _, link := range t.links { for _, link := range t.links {
links = append(links, link) links = append(links, link)
} }
@ -412,7 +412,6 @@ func (t *tun) process() {
// and the message is being sent outbound via // and the message is being sent outbound via
// a dialled connection don't use this link // a dialled connection don't use this link
if loopback && msg.outbound { if loopback && msg.outbound {
log.Tracef("Link for node %s is loopback", id)
err = errors.New("link is loopback") err = errors.New("link is loopback")
continue continue
} }
@ -420,7 +419,6 @@ func (t *tun) process() {
// if the message was being returned by the loopback listener // if the message was being returned by the loopback listener
// send it back up the loopback link only // send it back up the loopback link only
if msg.loopback && !loopback { if msg.loopback && !loopback {
log.Tracef("Link for message from %s is loopback", id)
err = errors.New("link is not loopback") err = errors.New("link is not loopback")
continue continue
} }
@ -458,7 +456,7 @@ func (t *tun) process() {
t.RLock() t.RLock()
var newLinks []*link var newLinks []*link
for _, link := range t.links { for _, link := range t.links {
newLinks = append(links, link) newLinks = append(newLinks, link)
} }
t.RUnlock() t.RUnlock()
// links were updated // links were updated
@ -583,10 +581,10 @@ func (t *tun) delLink(remote string) {
delete(t.links, id) delete(t.links, id)
} }
t.Unlock()
// let ourselves know of a link change // let ourselves know of a link change
go t.notify() go t.notify()
t.Unlock()
} }
// notify ourselves of a link change // notify ourselves of a link change
@ -681,7 +679,6 @@ func (t *tun) listen(link *link) {
// nothing more to do // nothing more to do
continue continue
case "close": case "close":
log.Debugf("Tunnel link %s received close message", link.Remote())
// if there is no channel then we close the link // if there is no channel then we close the link
// as its a signal from the other side to close the connection // as its a signal from the other side to close the connection
if len(channel) == 0 { if len(channel) == 0 {
@ -689,6 +686,7 @@ func (t *tun) listen(link *link) {
return return
} }
log.Debugf("Tunnel link %s received close message for %s", link.Remote(), channel)
// the entire listener was closed by the remote side so we need to // the entire listener was closed by the remote side so we need to
// remove the channel mapping for it. should we also close sessions? // remove the channel mapping for it. should we also close sessions?
if sessionId == "listener" { if sessionId == "listener" {
@ -1365,9 +1363,8 @@ func (t *tun) Listen(channel string, opts ...ListenOption) (Listener, error) {
} }
func (t *tun) Links() []Link { func (t *tun) Links() []Link {
links := make([]Link, 0, len(t.links))
t.RLock() t.RLock()
links := make([]Link, 0, len(t.links))
for _, link := range t.links { for _, link := range t.links {
links = append(links, link) links = append(links, link)