mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 13:55:17 +00:00
libs: wrap mutexes for build flag with godeadlock (#5126)
## Description This PR wraps the stdlib sync.(RW)Mutex & godeadlock.(RW)Mutex. This enables using go-deadlock via a build flag instead of using sed to replace sync with godeadlock in all files Closes: #3242
This commit is contained in:
@@ -9,8 +9,8 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
tmsync "github.com/tendermint/tendermint/libs/sync"
|
||||
types "github.com/tendermint/tendermint/rpc/jsonrpc/types"
|
||||
)
|
||||
|
||||
@@ -99,7 +99,7 @@ type Client struct {
|
||||
|
||||
client *http.Client
|
||||
|
||||
mtx sync.Mutex
|
||||
mtx tmsync.Mutex
|
||||
nextReqID int
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ type jsonRPCBufferedRequest struct {
|
||||
type RequestBatch struct {
|
||||
client *Client
|
||||
|
||||
mtx sync.Mutex
|
||||
mtx tmsync.Mutex
|
||||
requests []*jsonRPCBufferedRequest
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
tmrand "github.com/tendermint/tendermint/libs/rand"
|
||||
"github.com/tendermint/tendermint/libs/service"
|
||||
tmsync "github.com/tendermint/tendermint/libs/sync"
|
||||
types "github.com/tendermint/tendermint/rpc/jsonrpc/types"
|
||||
)
|
||||
|
||||
@@ -56,7 +57,7 @@ type WSClient struct { // nolint: maligned
|
||||
|
||||
wg sync.WaitGroup
|
||||
|
||||
mtx sync.RWMutex
|
||||
mtx tmsync.RWMutex
|
||||
sentLastPingAt time.Time
|
||||
reconnecting bool
|
||||
nextReqID int
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
tmsync "github.com/tendermint/tendermint/libs/sync"
|
||||
types "github.com/tendermint/tendermint/rpc/jsonrpc/types"
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ var wsCallTimeout = 5 * time.Second
|
||||
|
||||
type myHandler struct {
|
||||
closeConnAfterRead bool
|
||||
mtx sync.RWMutex
|
||||
mtx tmsync.RWMutex
|
||||
}
|
||||
|
||||
var upgrader = websocket.Upgrader{
|
||||
|
||||
Reference in New Issue
Block a user