Skip to content

Commit 9be161e

Browse files
mohansonCopilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent dfd56fa commit 9be161e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

protocol/etch/engine.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ func (s *Server) Run() error {
140140
if err != nil {
141141
return
142142
}
143-
idx++
144-
ctx := &daze.Context{Cid: idx}
143+
cid := atomic.AddUint32(&idx, 1)
144+
ctx := &daze.Context{Cid: cid}
145145
cli := &Stream{rem: rem, stm: stm}
146146
log.Printf("conn: %08x accept remote=%s", ctx.Cid, rem)
147147
rtc := &daze.ReadWriteCloser{

0 commit comments

Comments
 (0)