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
net/http/httptest: Server.Start shouldn't return until it really can Accept connections #23757
Comments
Why? That's not intentional, and I've never experienced that. If there's a problem, the fix is to make Why do you think |
Why does the server take time to be ready? Is this delay your code or the http package?
… On 9 Feb 2018, at 14:49, Zhonghu Xu ***@***.***> wrote:
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
latest
Does this issue reproduce with the latest release?
yes
What did you do?
After call httptest.Server.Start or StartTLS, I want the server is ready to serve any request. But unfortunately it takes some time to be ready.
And i think
func (s *Server) goServe() {
s.wg.Add(1)
go func() {
defer s.wg.Done()
s.Config.Serve(s.Listener)
}()
s.wg.Wait() // this should be added.
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Because it call |
@bradfitz I think we can notify the parent goroutine when the below goroutine is running. func (s *Server) goServe() {
s.wg.Add(1)
go func() {
defer s.wg.Done()
s.Config.Serve(s.Listener)
}()
} |
But the I see no problem. |
Oh, so i missed the listener. |
No worries. Glad there's not a problem to fix. :) |
Thank you . |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?latest
Does this issue reproduce with the latest release?
yes
What did you do?
After call
httptest.Server.Start
orStartTLS
, I want the server is ready to serve any request. But unfortunately it takes some time to be ready.The text was updated successfully, but these errors were encountered: