internal/jsonrpc2_v2: remove “Box” suffix from channel field names
With the suffixes I end up a little lost in the “box” noise while I'm reading — the channel ops alone suffice to make the storage mechanism clear. (To me, the mechanism of storing a value in a 1-buffered channel is conceptually similar to storing it in a pointer, atomic.Pointer, or similar — and we don't generally name those with a suffix either.) For golang/go#46047. For golang/go#46520. For golang/go#49387. Change-Id: I7f58a9ac532f597fe49ed70606d89bd8cbe33b55 Reviewed-on: https://go-review.googlesource.com/c/tools/+/443355 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> gopls-CI: kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
9e251950a6
commit
c252ba2612
1 changed files with 48 additions and 48 deletions
|
|
@ -77,7 +77,7 @@ type binder struct {
|
|||
type handler struct {
|
||||
conn *jsonrpc2.Connection
|
||||
accumulator int
|
||||
waitersBox chan map[string]chan struct{}
|
||||
waiters chan map[string]chan struct{}
|
||||
calls map[string]*jsonrpc2.AsyncCall
|
||||
}
|
||||
|
||||
|
|
@ -256,11 +256,11 @@ func verifyResults(t *testing.T, method string, results interface{}, expect inte
|
|||
|
||||
func (b binder) Bind(ctx context.Context, conn *jsonrpc2.Connection) (jsonrpc2.ConnectionOptions, error) {
|
||||
h := &handler{
|
||||
conn: conn,
|
||||
waitersBox: make(chan map[string]chan struct{}, 1),
|
||||
calls: make(map[string]*jsonrpc2.AsyncCall),
|
||||
conn: conn,
|
||||
waiters: make(chan map[string]chan struct{}, 1),
|
||||
calls: make(map[string]*jsonrpc2.AsyncCall),
|
||||
}
|
||||
h.waitersBox <- make(map[string]chan struct{})
|
||||
h.waiters <- make(map[string]chan struct{})
|
||||
if b.runTest != nil {
|
||||
go b.runTest(h)
|
||||
}
|
||||
|
|
@ -272,8 +272,8 @@ func (b binder) Bind(ctx context.Context, conn *jsonrpc2.Connection) (jsonrpc2.C
|
|||
}
|
||||
|
||||
func (h *handler) waiter(name string) chan struct{} {
|
||||
waiters := <-h.waitersBox
|
||||
defer func() { h.waitersBox <- waiters }()
|
||||
waiters := <-h.waiters
|
||||
defer func() { h.waiters <- waiters }()
|
||||
waiter, found := waiters[name]
|
||||
if !found {
|
||||
waiter = make(chan struct{})
|
||||
|
|
|
|||
Loading…
Reference in a new issue