Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make sure the server is stopped before closing all server sessions #3020

Merged
merged 1 commit into from
Jan 25, 2021

Conversation

marten-seemann
Copy link
Member

Fixes #3019.

@rip-create-your-account Do you think this fixes the bug that you discovered?

@codecov
Copy link

codecov bot commented Jan 23, 2021

Codecov Report

Merging #3020 (aea8f73) into master (f1500db) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3020   +/-   ##
=======================================
  Coverage   86.14%   86.14%           
=======================================
  Files         135      135           
  Lines        9457     9458    +1     
=======================================
+ Hits         8146     8147    +1     
  Misses        952      952           
  Partials      359      359           
Impacted Files Coverage Δ
packet_handler_map.go 74.27% <ø> (ø)
server.go 82.25% <100.00%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f1500db...aea8f73. Read the comment docs.

server.go Outdated
Comment on lines 292 to 297
s.sessionHandler.CloseServer()
var err error
if createdPacketConn {
err = s.sessionHandler.Destroy()
}
<-s.running

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think CloseServer() could still be called before (*baseServer).run finishes processing a packet and calls AddWithConnID with the same end result.

I think receiving <-s.running is necessary before calling CloseServer() to ensure that (*baseServer).run is not processing a packet.

	<-s.running
	s.sessionHandler.CloseServer()
  var err error
	if createdPacketConn {
		err = s.sessionHandler.Destroy()
	}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Thank you!

@marten-seemann marten-seemann merged commit 7456e64 into master Jan 25, 2021
@marten-seemann marten-seemann deleted the fix-server-closing branch January 29, 2021 05:20
@aschmahmann aschmahmann mentioned this pull request May 14, 2021
71 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New session is left to linger if created while (*packetHandlerMap).CloseServer is executing
3 participants