Skip to content

Commit 636d418

Browse files
committed
replace sync.Mutex with deadlock.Mutex
1 parent 4a53502 commit 636d418

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

tools/debug/algodump/compress.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"sort"
2727
"strconv"
2828
"strings"
29-
"sync"
3029
"syscall"
3130
"time"
3231

@@ -36,6 +35,7 @@ import (
3635
"github.com/algorand/go-algorand/data/transactions"
3736
"github.com/algorand/go-algorand/network"
3837
"github.com/algorand/go-algorand/protocol"
38+
"github.com/algorand/go-deadlock"
3939
kzstd "github.com/klauspost/compress/zstd"
4040
"github.com/valyala/gozstd"
4141
)
@@ -109,24 +109,24 @@ type tagStats struct {
109109
compressedBytes uint64
110110
messageCount uint64
111111
contextBytes uint64
112-
mu sync.Mutex
112+
mu deadlock.Mutex
113113
}
114114

115115
// compressDumpHandler extends dumpHandler with compression functionality
116116
type compressDumpHandler struct {
117117
*dumpHandler // Embed the original dumpHandler
118118
stats map[protocol.Tag]*tagStats
119-
statsMutex sync.Mutex
119+
statsMutex deadlock.Mutex
120120
compressor *zstd.BulkProcessor
121121
contexts map[string]*CompressionContext
122-
contextMu sync.Mutex
122+
contextMu deadlock.Mutex
123123
dict []byte
124124
cdict *gozstd.CDict // Reusable gozstd dictionary
125125

126126
// Tag-specific context configuration
127127
tagContexts map[protocol.Tag]int // Maps tag to window size
128128
tagGroups map[protocol.Tag]string // Maps tag to group name for shared contexts
129-
tagContextsMu sync.Mutex
129+
tagContextsMu deadlock.Mutex
130130
}
131131

132132
// setupCompressSignalHandler sets up a signal handler for the compressDumpHandler

tools/debug/algodump/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"os/signal"
2626
"path/filepath"
2727
"strings"
28-
"sync"
2928
"syscall"
3029
"time"
3130

@@ -59,7 +58,7 @@ type StoredMessage struct {
5958
// dumpHandler handles dumping network messages to console/files
6059
type dumpHandler struct {
6160
tags map[protocol.Tag]bool
62-
storeMutex sync.Mutex
61+
storeMutex deadlock.Mutex
6362
storeBuffer []StoredMessage
6463
storeSize int
6564
storeCounter int

0 commit comments

Comments
 (0)