1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-02 03:28:25 +08:00

hotfix(dep) duplicates TEMP DONT MERGE TO MASTER

before merging, fork and send a PR to tuxy

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
This commit is contained in:
Brian Tiger Chow
2014-11-21 18:01:24 -08:00
committed by Jeromy
parent e4c9731643
commit 044db5bee8

View File

@ -66,6 +66,14 @@ func (ps *PubSub) AddSub(ch chan interface{}, topics ...string) {
ps.cmdChan <- cmd{op: sub, topics: topics, ch: ch}
}
// AddSubOnce adds one-time subscriptions to an existing channel.
// For each topic, a message will be sent once.
func (ps *PubSub) AddSubOnce(ch chan interface{}, topics ...string) {
for _, t := range topics {
ps.cmdChan <- cmd{op: subOnce, topics: []string{t}, ch: ch}
}
}
// Pub publishes the given message to all subscribers of
// the specified topics.
func (ps *PubSub) Pub(msg interface{}, topics ...string) {