diff options
author | Alex Auvolat <alex@adnab.me> | 2020-03-04 18:16:26 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-03-04 18:16:26 +0100 |
commit | 8e67699fe4c3e78aa5b372c2ded434409f580615 (patch) | |
tree | 55a016d5e37fb4c0599286fbb65f2f0629b255f3 /connector/mattermost | |
parent | 536f3cd6b86370b1134cd3e64c8a0e81db0f9e6f (diff) | |
download | easybridge-8e67699fe4c3e78aa5b372c2ded434409f580615.tar.gz easybridge-8e67699fe4c3e78aa5b372c2ded434409f580615.zip |
Better practices
Diffstat (limited to 'connector/mattermost')
-rw-r--r-- | connector/mattermost/mattermost.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/connector/mattermost/mattermost.go b/connector/mattermost/mattermost.go index ea49fd2..9410126 100644 --- a/connector/mattermost/mattermost.go +++ b/connector/mattermost/mattermost.go @@ -31,7 +31,7 @@ type Mattermost struct { initial_backlog int // How many previous messages (maximum) to load when first joining a channel conn *matterclient.MMClient - handlerStopChan chan bool + handlerStopChan chan struct{} caches mmCaches } @@ -59,7 +59,7 @@ func (mm *Mattermost) Configure(c Configuration) error { } // Reinitialize shared data structures - mm.handlerStopChan = make(chan bool, 1) + mm.handlerStopChan = make(chan struct{}) mm.caches.mmusers = make(map[string]string) mm.caches.sentjoined = make(map[string]bool) @@ -323,7 +323,7 @@ func (mm *Mattermost) Close() { mm.conn.WsQuit = true } if mm.handlerStopChan != nil { - mm.handlerStopChan <- true + close(mm.handlerStopChan) mm.handlerStopChan = nil } } @@ -484,7 +484,7 @@ func (mm *Mattermost) processBacklog(ch *model.Channel, backlog *model.PostList) } } -func (mm *Mattermost) handleLoop(msgCh chan *matterclient.Message, quitCh chan bool) { +func (mm *Mattermost) handleLoop(msgCh chan *matterclient.Message, quitCh chan struct{}) { for { select { case <-quitCh: |