diff --git a/ci/container/Dockerfile b/ci/container/Dockerfile index fd008788..0c6c2a54 100644 --- a/ci/container/Dockerfile +++ b/ci/container/Dockerfile @@ -10,5 +10,5 @@ RUN go get golang.org/x/tools/cmd/stringer RUN go get golang.org/x/lint/golint RUN go get github.com/agnivade/wasmbrowsertest -RUN npm install -g prettier -RUN npm install -g netlify-cli +RUN npm --unsafe-perm=true install -g prettier +RUN npm --unsafe-perm=true install -g netlify-cli diff --git a/conn_notjs.go b/conn_notjs.go index bb2eb22f..0c85ab77 100644 --- a/conn_notjs.go +++ b/conn_notjs.go @@ -189,7 +189,7 @@ func (c *Conn) Ping(ctx context.Context) error { } func (c *Conn) ping(ctx context.Context, p string) error { - pong := make(chan struct{}) + pong := make(chan struct{}, 1) c.activePingsMu.Lock() c.activePings[p] = pong diff --git a/read.go b/read.go index afd08cc7..ae05cf93 100644 --- a/read.go +++ b/read.go @@ -271,7 +271,10 @@ func (c *Conn) handleControl(ctx context.Context, h header) (err error) { pong, ok := c.activePings[string(b)] c.activePingsMu.Unlock() if ok { - close(pong) + select { + case pong <- struct{}{}: + default: + } } return nil }