Skip to content

Commit

Permalink
Merge pull request #303 from YouShengLiu/bugfix/race-condition
Browse files Browse the repository at this point in the history
fix: add lock at WriteTo
  • Loading branch information
wmnsk authored Oct 23, 2024
2 parents 5414bc8 + cceb5ea commit f103b7b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gtpv1/u-conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,8 @@ func (u *UPlaneConn) ReadFromGTP(p []byte) (n int, addr net.Addr, teid uint32, e
// see SetDeadline and SetWriteDeadline.
// On packet-oriented connections, write timeouts are rare.
func (u *UPlaneConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
u.mu.Lock()
defer u.mu.Unlock()
return u.pktConn.WriteToWithDSCPECN(p, addr, 0)
}

Expand Down

0 comments on commit f103b7b

Please sign in to comment.