Skip to content

Commit

Permalink
fix(kuma-cp) add extra check under the second lock
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Lobkov <lobkovilya@yandex.ru>
  • Loading branch information
lobkovilya committed Jul 13, 2021
1 parent 218b515 commit 4c3200a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/xds/server/callbacks/dataplane_callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ func (d *xdsCallbacks) OnStreamRequest(streamID core_xds.StreamID, request util_
}

d.Lock()
// in case client will open 2 concurrent request for the same streamID then
// we don't to increment the counter twice, so checking once again that stream
// wasn't processed
alreadyProcessed = d.dpStreams[streamID].dp != nil
if alreadyProcessed {
return nil
}

dpStream := d.dpStreams[streamID]
dpStream.dp = &dpKey
d.dpStreams[streamID] = dpStream
Expand Down

0 comments on commit 4c3200a

Please sign in to comment.