diff --git a/Makefile b/Makefile index 3d463ff45..4ccfb3562 100644 --- a/Makefile +++ b/Makefile @@ -63,6 +63,7 @@ test: ## Run tests #${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/... ${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/app/... ${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/cipher/... + ${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/dmsg/... ${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/manager/... ${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/messaging-discovery/... ${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/node/... diff --git a/pkg/dmsg/transport.go b/pkg/dmsg/transport.go index 5e1d28c8e..4cc074dd1 100644 --- a/pkg/dmsg/transport.go +++ b/pkg/dmsg/transport.go @@ -130,18 +130,18 @@ func (tp *Transport) Type() string { // HandleFrame allows 'tp.Serve' to handle the frame (typically from 'ClientConn'). func (tp *Transport) HandleFrame(f Frame) error { - if tp.IsClosed() { - return io.ErrClosedPipe - } - tp.inMx.RLock() defer tp.inMx.RUnlock() +handleFrame: select { - case <-tp.done: - return io.ErrClosedPipe case tp.inCh <- f: return nil + default: + if tp.IsClosed() { + return io.ErrClosedPipe + } + goto handleFrame } }