Fix bugs related to needing to send Broadcast

This commit is contained in:
Asim Aslam 2019-10-15 15:55:08 +01:00
parent 7b1f5584ab
commit ca18089382
3 changed files with 8 additions and 4 deletions

View File

@ -326,7 +326,7 @@ func (t *tun) process() {
}
// check the multicast mappings
if msg.mode > Unicast {
if msg.mode == Multicast {
link.RLock()
_, ok := link.channels[msg.channel]
link.RUnlock()

View File

@ -125,7 +125,7 @@ func (s *session) Open() error {
}
// don't wait on multicast/broadcast
if s.mode > Unicast {
if s.mode == Multicast {
s.accepted = true
return nil
}
@ -163,7 +163,7 @@ func (s *session) Accept() error {
}
// don't wait on multicast/broadcast
if s.mode > Unicast {
if s.mode == Multicast {
return nil
}
@ -223,7 +223,7 @@ func (s *session) Send(m *transport.Message) error {
msg.data = data
// if multicast don't set the link
if s.mode > Unicast {
if s.mode == Multicast {
msg.link = ""
}

View File

@ -9,8 +9,11 @@ import (
)
const (
// send over one link
Unicast Mode = iota
// send to all channel listeners
Multicast
// send to all listeners
Broadcast
)
@ -25,6 +28,7 @@ var (
ErrLinkNotFound = errors.New("link not found")
)
// Mode of the session
type Mode uint8
// Tunnel creates a gre tunnel on top of the go-micro/transport.