mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-01-07 23:33:08 +00:00
don't always spawn a goroutine for sending a new message
This commit is contained in:
parent
c95ed28496
commit
5ef13c764e
14
floodsub.go
14
floodsub.go
@ -367,12 +367,14 @@ func (p *PubSub) pushMsg(subs []*Subscription, src peer.ID, msg *Message) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
sreq := sendReq{from: src, msg: msg}
|
||||||
p.sendMsg <- sendReq{
|
select {
|
||||||
from: src,
|
case p.sendMsg <- sreq:
|
||||||
msg: msg,
|
default:
|
||||||
}
|
go func() {
|
||||||
}()
|
p.sendMsg <- sreq
|
||||||
|
}()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate performs validation and only sends the message if all validators succeed
|
// validate performs validation and only sends the message if all validators succeed
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user