diff options
author | Kevin Chabowski <kevin@kch42.de> | 2014-03-27 21:36:19 +0100 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2014-03-27 23:51:08 +0100 |
commit | 5c45b0e3e5fbe479155ad403b4936d2485a028bd (patch) | |
tree | 016380d925926b2150819a98fd46dd99ddff53a2 /chat | |
parent | e1725316e8d04124ba4409807bcc3e6189afc167 (diff) | |
download | simplechat-5c45b0e3e5fbe479155ad403b4936d2485a028bd.tar.gz simplechat-5c45b0e3e5fbe479155ad403b4936d2485a028bd.tar.bz2 simplechat-5c45b0e3e5fbe479155ad403b4936d2485a028bd.zip |
Stopping the ticker in Push
Diffstat (limited to 'chat')
-rw-r--r-- | chat/buddy.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/chat/buddy.go b/chat/buddy.go index 5b2308c..d369c61 100644 --- a/chat/buddy.go +++ b/chat/buddy.go @@ -28,9 +28,11 @@ func (b *Buddy) Leave() { // Push pushes a message to the buddies Receive channel func (b *Buddy) Push(msg Message) { go func() { + t := time.NewTicker(time.Millisecond * 100) + defer t.Stop() select { case b.Receive <- msg: - case <-time.Tick(time.Millisecond * 100): + case <-t.C: } }() } |