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

session.go: AcceptStream handles GoAway #18

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ginkoob
Copy link

@ginkoob ginkoob commented Sep 2, 2015

Closes #17

@armon
Copy link
Member

armon commented Sep 4, 2015

@ginkoob So I now remember why it works this way. The GoAway is meant to do a half-close. e.g. it indicates to the other side that no new streams will be accepted. Similar to Close in TCP which goes to half-duplex.

@ginkoob
Copy link
Author

ginkoob commented Sep 4, 2015

Ok but why does it work only from server to client? Why the client can't say "GoAway" to the server? I think this PR does just that.

session.go Outdated
@@ -92,6 +95,7 @@ func newSession(config *Config, conn io.ReadWriteCloser, client bool) *Session {
streams: make(map[uint32]*Stream),
synCh: make(chan struct{}, config.AcceptBacklog),
acceptCh: make(chan *Stream, config.AcceptBacklog),
goAwayCh: make(chan struct{}, 1),
Copy link
Contributor

Choose a reason for hiding this comment

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

Little bit of a formatting fail (needs to be indented). Also, make(chan struct{}) should be sufficient.

Copy link
Author

Choose a reason for hiding this comment

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

I think we should create the goAwayCh only if the peer is a server so I've moved it to the if client {}else{}. Let me know if you think otherwise.
I've noticed that now session_test.go:375 - client2.GoAway() always throws err: session shutdown. It shouldn't be an issue as the client shouldn't try to open connections after GoAway but still I don't know why it errors out.

@slackpad
Copy link
Contributor

slackpad commented Sep 4, 2015

Noted a couple small things. I see the distinction here - the go away won't cause the server blocked in Accept or AcceptStream to bail out.

@slackpad
Copy link
Contributor

slackpad commented Sep 8, 2015

Latest code looks good. Only last thing is the fail you mentioned in #18 (comment) - I can't reproduce that running your branch locally, and it doesn't make sense given how you've got the delay in there. Are you still seeing that?

@hashicorp-cla
Copy link

hashicorp-cla commented Dec 6, 2019

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes


root seems not to be a GitHub user.
You need a GitHub account to be able to sign the CLA.
If you have already a GitHub account, please add the email address used for this commit to your account.

Have you signed the CLA already but the status is still pending? Recheck it.

@evanphx
Copy link
Contributor

evanphx commented Jul 28, 2022

Given the age, I'm going to go ahead and close this PR. Per @armon's mention, GoAway wasn't meant to be sent from a client to a server anyway.

@evanphx evanphx closed this Jul 28, 2022
@evanphx evanphx reopened this Jul 28, 2022
@evanphx
Copy link
Contributor

evanphx commented Jul 28, 2022

@ginkoob If you can sign the CLA, I think we can merge this.

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.

The server should handle GoAway frames
5 participants