Close shuts down the proxy and all active connections.
()
| 43 | |
| 44 | // Close shuts down the proxy and all active connections. |
| 45 | func (p *LatencyProxy) Close() error { |
| 46 | p.mu.Lock() |
| 47 | p.closed = true |
| 48 | conns := p.conns |
| 49 | p.conns = nil |
| 50 | p.mu.Unlock() |
| 51 | |
| 52 | for _, c := range conns { |
| 53 | _ = c.Close() |
| 54 | } |
| 55 | return p.listener.Close() |
| 56 | } |
| 57 | |
| 58 | func (p *LatencyProxy) acceptLoop() { |
| 59 | for { |