Method
ServeHTTP
(w http.ResponseWriter, r *http.Request)
Source from the content-addressed store, hash-verified
| 26 | } |
| 27 | |
| 28 | func (ph *PauseableHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
| 29 | ph.mu.Lock() |
| 30 | paused := ph.paused |
| 31 | ph.mu.Unlock() |
| 32 | if !paused { |
| 33 | ph.Next.ServeHTTP(w, r) |
| 34 | } else { |
| 35 | hj, ok := w.(http.Hijacker) |
| 36 | if !ok { |
| 37 | panic("webserver doesn't support hijacking") |
| 38 | } |
| 39 | conn, _, err := hj.Hijack() |
| 40 | if err != nil { |
| 41 | panic(err.Error()) |
| 42 | } |
| 43 | conn.Close() |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | func (ph *PauseableHandler) Pause() { |
| 48 | ph.mu.Lock() |
Callers
nothing calls this directly
Tested by
no test coverage detected