'Send desired configuration and cluster state to all given connections.
:param connections: A collection of ``AMP`` instances.'

def _send_state_to_connections(self, connections):

    configuration = self.configuration_service.get()
    state = self.cluster_state.as_deployment()
    can_update = []
    delayed_update = []
    elided_update = []
    for connection in connections:
        try:
            update = self._current_command[connection]
        except KeyError:
            can_update.append(connection)
        else:
            if update.next_scheduled:
                elided_update.append(connection)
            else:
                delayed_update.append(connection)
    with LOG_SEND_CLUSTER_STATE() as action:
        if can_update:
            action.add_success_fields(configuration=configuration, state=state)
        else:
            action.add_success_fields(configuration=None, state=None)
        for connection in can_update:
            self._update_connection(connection, configuration, state)
        for connection in elided_update:
            AGENT_UPDATE_ELIDED(agent=connection).write()
        for connection in delayed_update:
            self._delayed_update_connection(connection)
