// closeConnection closes a connection and removes it from the connections-map // The h.networkLock must be taken. func (h *Host) closeConnection(c network.SecureConn) error { h.networkLock.Lock() defer h.networkLock.Unlock() log.Lvl4(h.ServerIdentity.First(), "Closing connection", c, c.Remote(), c.Local()) err := c.Close() if err != nil { return err } delete(h.connections, c.ServerIdentity().ID) return nil }