From e8d5a79801342745d8ad89425f749b9a4fb525d6 Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Sun, 27 May 2018 16:07:21 +0200 Subject: [PATCH] Renamed Client's EmitSafe to EmitNonBlocking to make it clearer what it's for. --- client.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client.go b/client.go index d55edbc..6f196a1 100644 --- a/client.go +++ b/client.go @@ -222,7 +222,7 @@ func (client *Client) Send(line string) error { _, err := conn.Write([]byte(line)) if err != nil { - client.EmitSafe(NewErrorEvent("network", err.Error())) + client.EmitNonBlocking(NewErrorEvent("network", err.Error())) client.Disconnect() } @@ -265,10 +265,10 @@ func (client *Client) Emit(event Event) context.Context { return event.ctx } -// EmitSafe is just like emit, but it will spin off a goroutine if the channel is full. -// This lets it be called from other handlers without risking a deadlock. See Emit for -// what the returned context is for. -func (client *Client) EmitSafe(event Event) context.Context { +// EmitNonBlocking is just like emit, but it will spin off a goroutine if the channel is full. +// This lets it be called from other handlers without ever blocking. See Emit for what the +// returned context is for. +func (client *Client) EmitNonBlocking(event Event) context.Context { event.ctx, event.cancel = context.WithCancel(client.ctx) select {