Skip to content

Commit

Permalink
fix data race
Browse files Browse the repository at this point in the history
  • Loading branch information
sijms committed May 2, 2024
1 parent b676477 commit 032d50b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions v2/network/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,10 @@ func (session *Session) LoadState() (oldState *SessionState) {
}

func (session *Session) resetWrite() {
session.mu.Lock()
session.sendPcks = nil
session.outBuffer.Reset()
session.mu.Unlock()
}
func (session *Session) resetRead() {
session.inBuffer = nil
Expand Down Expand Up @@ -679,9 +681,7 @@ func (session *Session) Write() error {
func (session *Session) processMarker() error {
var err error
// send reset connection
session.mu.Lock()
session.resetWrite()
session.mu.Unlock()
marker := newMarkerPacket(marker_type_reset, session.Context)
err = session.writePacket(marker)
if err != nil {
Expand Down

0 comments on commit 032d50b

Please sign in to comment.