summaryrefslogtreecommitdiff
path: root/error_buffer.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-05-04 00:09:12 +0300
committerGitHub <[email protected]>2019-05-04 00:09:12 +0300
commit727602f9d6e3b5a92f6fa0d7a497ab1ef358a349 (patch)
treeec41356d3e421284f44d8c82f3b297e5c8ab2c7a /error_buffer.go
parentf4515e276179d77e3f9457ba0d99545081ae50ea (diff)
parent8a2f79a622e9b3b6e20718a257bfdaaf8dbb8747 (diff)
Merge pull request #144 from spiral/feature/updates
WIP: 1.4.0
Diffstat (limited to 'error_buffer.go')
-rw-r--r--error_buffer.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/error_buffer.go b/error_buffer.go
index fec789a9..0eaf03b6 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;
@@ -88,14 +87,13 @@ func (eb *errBuffer) Len() int {
return len(eb.buf)
}
-// Write appends the contents of p to the errBuffer, growing the errBuffer as
-// needed. The return value n is the length of p; err is always nil.
+// Write appends the contents of pool to the errBuffer, growing the errBuffer as
+// needed. The return value n is the length of pool; 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
}