Don't try discover on multicast, don't block existing sessions on listen
This commit is contained in:
		| @@ -814,6 +814,14 @@ func (t *tun) Dial(channel string, opts ...DialOption) (Session, error) { | |||||||
| 	// set the dial timeout | 	// set the dial timeout | ||||||
| 	c.timeout = options.Timeout | 	c.timeout = options.Timeout | ||||||
|  |  | ||||||
|  | 	// don't bother with the song and dance below | ||||||
|  | 	// we're just going to assume things come online | ||||||
|  | 	// as and when. | ||||||
|  | 	if c.multicast { | ||||||
|  | 		return c, nil | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// non multicast so we need to find the link | ||||||
| 	t.RLock() | 	t.RLock() | ||||||
| 	for _, link := range t.links { | 	for _, link := range t.links { | ||||||
| 		link.RLock() | 		link.RLock() | ||||||
|   | |||||||
| @@ -64,8 +64,9 @@ func (t *tunListener) process() { | |||||||
| 			sess, ok := conns[m.session] | 			sess, ok := conns[m.session] | ||||||
| 			log.Debugf("Tunnel listener received channel %s session %s exists: %t", m.channel, m.session, ok) | 			log.Debugf("Tunnel listener received channel %s session %s exists: %t", m.channel, m.session, ok) | ||||||
| 			if !ok { | 			if !ok { | ||||||
| 				// only create new sessions on open message | 				switch m.typ { | ||||||
| 				if m.typ != "open" { | 				case "open", "session": | ||||||
|  | 				default: | ||||||
| 					continue | 					continue | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| @@ -104,9 +105,6 @@ func (t *tunListener) process() { | |||||||
| 				// send to accept chan | 				// send to accept chan | ||||||
| 				case t.accept <- sess: | 				case t.accept <- sess: | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				// continue |  | ||||||
| 				continue |  | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			// an existing session was found | 			// an existing session was found | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user