fixed nil pointer when closing stream

This commit is contained in:
Brad Rydzewski
2016-04-22 17:50:28 -07:00
parent 34c3c92ec3
commit f8a2a32383
2 changed files with 3 additions and 1 deletions

View File

@@ -171,6 +171,7 @@ func Stream(c *gin.Context) {
wg.Done() wg.Done()
}() }()
wc.Close()
wg.Wait() wg.Wait()
c.String(200, "") c.String(200, "")

View File

@@ -61,8 +61,9 @@ func (s *stream) Delete(name string) error {
if !s.exists(name) { if !s.exists(name) {
return fmt.Errorf("stream: cannot delete stream %s, not found", name) return fmt.Errorf("stream: cannot delete stream %s, not found", name)
} }
w := s.writers[name]
delete(s.writers, name) delete(s.writers, name)
return s.writers[name].Close() return w.Close()
} }
func (s *stream) exists(name string) bool { func (s *stream) exists(name string) bool {