diff options
Diffstat (limited to 'error_buffer.go')
-rw-r--r-- | error_buffer.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/error_buffer.go b/error_buffer.go index fec789a9..becd8295 100644 --- a/error_buffer.go +++ b/error_buffer.go @@ -73,9 +73,8 @@ func newErrBuffer() *errBuffer { // Listen attaches error stream even listener. func (eb *errBuffer) Listen(l func(event int, ctx interface{})) { eb.mu.Lock() - defer eb.mu.Unlock() - eb.lsn = l + eb.mu.Unlock() } // Len returns the number of buf of the unread portion of the errBuffer; @@ -92,10 +91,9 @@ func (eb *errBuffer) Len() int { // needed. The return value n is the length of p; err is always nil. func (eb *errBuffer) Write(p []byte) (int, error) { eb.mu.Lock() - defer eb.mu.Unlock() - eb.buf = append(eb.buf, p...) eb.update <- nil + eb.mu.Unlock() return len(p), nil } |