node icon indicating copy to clipboard operation
node copied to clipboard

Fix a probable gvisor panic on peer disconnect

Open Zensey opened this issue 3 years ago • 1 comments

Zensey avatar Sep 13 '22 11:09 Zensey

Codecov Report

Merging #5426 (f74ff77) into master (28b74a6) will decrease coverage by 0.14%. The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #5426      +/-   ##
==========================================
- Coverage   38.07%   37.93%   -0.15%     
==========================================
  Files         358      358              
  Lines       19882    19882              
==========================================
- Hits         7570     7542      -28     
- Misses      11573    11592      +19     
- Partials      739      748       +9     
Impacted Files Coverage Δ
nat/traversal/pinger.go 73.64% <0.00%> (-5.82%) :arrow_down:
core/policy/oracle.go 86.48% <0.00%> (-5.41%) :arrow_down:
requests/dialer_swarm.go 75.93% <0.00%> (-3.01%) :arrow_down:
p2p/channel.go 66.06% <0.00%> (-0.73%) :arrow_down:
session/pingpong/consumer_balance_tracker.go 56.63% <0.00%> (-0.72%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Sep 20 '22 19:09 codecov-commenter

I think you could write it like this instead:


		wg.Add(2)
		go func() {
			defer wg.Done()
			tun.proxy(client, clientAddr, proxyConn) // loc <- remote
		}()
		go func() {
			defer wg.Done()
			tun.proxy(proxyConn, remoteAddr, client) // remote <- loc
		}
		wg.Wait()

to get rid of that useless wg parameter which actually belongs to outer function mechanics

Snawoot avatar Sep 26 '22 06:09 Snawoot