Skip to content

Commit

Permalink
fix: already subscribe to topic (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxinfeng96 authored Sep 20, 2023
1 parent 584756b commit f346c39
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion conn/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ func (hc *channelSession) subscribeTopic(topic string, handler func([]byte, *[]b
if handler == nil {
return errors.New("handler is nil")
}
if _, ok := hc.topicHandlers[topic]; ok {
if oldHandler, ok := hc.topicHandlers[topic]; ok && oldHandler != nil {
return errors.New("already subscribed to topic " + topic)
}
hc.topicMu.Lock()
Expand Down

0 comments on commit f346c39

Please sign in to comment.