From facd4b1d691ae3f9987e90028aec763367041830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ola=20Holmstr=C3=B6m?= Date: Sat, 13 Jun 2015 05:42:44 +0200 Subject: [PATCH] add async writes to broadcast --- hub.go | 4 ++-- melody_test.go | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hub.go b/hub.go index 657dbc1..2918fa6 100644 --- a/hub.go +++ b/hub.go @@ -31,10 +31,10 @@ func (h *hub) run() { for s := range h.sessions { if m.filter != nil { if m.filter(s) { - s.writeMessage(m) + go s.writeMessage(m) } } else { - s.writeMessage(m) + go s.writeMessage(m) } } } diff --git a/melody_test.go b/melody_test.go index 6de15c5..aa2e914 100644 --- a/melody_test.go +++ b/melody_test.go @@ -167,7 +167,6 @@ func TestUpgrader(t *testing.T) { } } -/* func TestBroadcast(t *testing.T) { broadcast := NewTestServer() broadcast.m.HandleMessage(func(session *Session, msg []byte) { @@ -212,7 +211,6 @@ func TestBroadcast(t *testing.T) { t.Error(err) } } -*/ func TestBroadcastOthers(t *testing.T) { broadcast := NewTestServer()