From 42b1aafdf8c66e25d5c227fbb4157ec5dc8a39e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ola=20Holmstr=C3=B6m?= Date: Fri, 18 Sep 2015 16:47:30 +0200 Subject: [PATCH] rewrite writeMessage --- session.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/session.go b/session.go index e0f5996..49c3461 100644 --- a/session.go +++ b/session.go @@ -16,9 +16,9 @@ type Session struct { } func (s *Session) writeMessage(message *envelope) { - if len(s.output) < s.melody.Config.MessageBufferSize { - s.output <- message - } else { + select { + case s.output <- message: + default: s.melody.errorHandler(s, errors.New("Message buffer full")) } }