Close closes all client connections and stops answering new connections.
()
| 155 | |
| 156 | // Close closes all client connections and stops answering new connections. |
| 157 | func (a *API) Close() { |
| 158 | a.lock.Lock() |
| 159 | defer a.lock.Unlock() |
| 160 | |
| 161 | for _, clients := range a.clients { |
| 162 | for _, client := range clients { |
| 163 | client.Close() |
| 164 | } |
| 165 | } |
| 166 | for k := range a.clients { |
| 167 | delete(a.clients, k) |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | func uniq[T comparable](s []T) []T { |
| 172 | m := make(map[T]struct{}, len(s)) |
no outgoing calls