Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
fix test case broadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed Sep 1, 2016
1 parent 76e5617 commit e9ea58a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion broadcast.go
Expand Up @@ -53,7 +53,7 @@ func (b *BroadcastString) AddListener(c chan string) chan string {
b.mu.Lock()
defer b.mu.Unlock()
if c == nil {
c = make(chan string, 0)
c = make(chan string, 4)
}
b.writers[c] = true
return c
Expand Down
2 changes: 2 additions & 0 deletions broadcast_test.go
Expand Up @@ -3,11 +3,13 @@ package main
import (
"sync"
"testing"
"time"
)

func TestBroadcast(t *testing.T) {
bs := NewBroadcastString()
bs.WriteMessage("hello")
time.Sleep(10 * time.Millisecond)
c1 := bs.AddListener(nil)
go func() {
bs.WriteMessage("world")
Expand Down

0 comments on commit e9ea58a

Please sign in to comment.