Skip to content

net/http: add CloseNotifier #2510

@gopherbot

Description

@gopherbot

by blake.mizerany:

Per email from Brad:

It looks like what you don't actually care about owning the TCP connection and ideally
just want something like:

 var clientClosed chan bool
 cn, ok := w.(http.CloseNotifier)
 if ok {
     clientClosed = cn.CloseChannel() // returns a chan bool, written to when/if this http request is closed
 }

 select {
  case <-clientClosed:
     // cancel expensive stuff
  case ....
  }

https://groups.google.com/d/topic/golang-nuts/PcEvewBB-AQ/discussion

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions