On Tuesday, April 18, 2017 at 5:51:40 AM UTC-7, Yuwei Ba wrote:
>
> Disabling the HTTP connection keep-alive may help for this situation by 
> calling: `srv.SetKeepAlivesEnabled(false)` and get the expected output 
> **sometimes**
>
> $ go run a.go
> In handler wrapper, f = 0xc4200111a0
> 1
> In handler wrapper, f = 0xc4200111a8
> 2
>
> Though,  it’s strange that you’ll still need to Sleep some time to make 
> sure the first server is cleaned properly.
>

Yes that's very strange.  My impression was that net.Listener.Close() would 
actually sever the running connections... and even if one was still open, 
I'm making a new http.Client object, too!

The listen address is definitely closed by this point, or the new listener 
would get the address already in use (which it still does even with 
KeepAlives disabled, if I don't sleep for 1 second...)

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to