File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ func (r *Receiver) Receive(multicastAddress string) {
4343 break
4444 } else {
4545 r .mutex .Lock ()
46+ r .cleanupDetections ()
4647 r .frames [frame .SenderId ] = frame
4748 r .receivedTimes [frame .SenderId ] = time .Now ()
4849 r .mutex .Unlock ()
@@ -90,16 +91,20 @@ func (r *Receiver) cleanupDetections() {
9091
9192func (r * Receiver ) GetLineSegments () map [string ][]* LineSegment {
9293 lines := map [string ][]* LineSegment {}
94+ r .mutex .Lock ()
9395 for _ , frame := range r .frames {
9496 lines [frame .SenderId ] = frame .Lines
9597 }
98+ r .mutex .Unlock ()
9699 return lines
97100}
98101
99102func (r * Receiver ) GetCircles () map [string ][]* Circle {
100103 lines := map [string ][]* Circle {}
104+ r .mutex .Lock ()
101105 for _ , frame := range r .frames {
102106 lines [frame .SenderId ] = frame .Circles
103107 }
108+ r .mutex .Unlock ()
104109 return lines
105110}
You can’t perform that action at this time.
0 commit comments