I could go read the source code so thanks in advance for saving me that 
step. Part of the reason I"m writing here is to also understand the 
recommended pattern...

Does StateActive imply the handler function will definitely be called, or 
can this state occur without the Handler ever being called? If definite, I 
think the comments/docs could use some clarification.

I need to definitively count net.Conn's that have been dropped prior to 
entering a handler function. ConnState provides a StateActive, but the docs 
imply this may be called after just 1 byte is read on the connection, which 
to my mind implies it may be called before the conn in question will ever 
result in a call to Handler.

Here we can assume the net.Conn will not ever be idled or handle more than 
one request.

I imagine if there is an error, the Handler will never be called and 
ConnState will get called again with StateClosed

What I really want is to get a notification immediately prior to the 
handler function being called, so that I can get my hands on the net.Conn.

Otherwise, I need to mark the net.Conn as having entered the handler 
function at the top of the handler function, which does not have direct 
access to the net.Conn because http.Request does not provide it.

The workaround would be to stash the net.Conn as a value in the 
request.Context() via ConnContext, but holy crap. Why make me jump through 
so many hoops golang?!

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/ed1fd75d-8a14-4b1c-b84f-d84490db084dn%40googlegroups.com.

Reply via email to