Logo Search packages:      
Sourcecode: libmpdclient version File versions  Download package

bool mpd_response_finish ( struct mpd_connection connection  ) 

Finishes the response and checks if the command was successful. If there are data pairs left, they are discarded.

Returns:
true on success, false on error

Definition at line 40 of file response.c.

References mpd_connection::discrete_finished, mpd_connection::error, mpd_recv_pair(), mpd_response_finish(), mpd_return_pair(), mpd_connection::pair_state, mpd_connection::receiving, and mpd_connection::sending_command_list.

Referenced by mpd_response_finish(), mpd_run_add(), mpd_run_add_id(), mpd_run_add_id_to(), mpd_run_clear(), mpd_run_current_song(), mpd_run_delete(), mpd_run_delete_id(), mpd_run_delete_range(), mpd_run_disable_output(), mpd_run_enable_output(), mpd_run_get_queue_song_id(), mpd_run_get_queue_song_pos(), mpd_run_idle(), mpd_run_idle_mask(), mpd_run_move(), mpd_run_move_id(), mpd_run_move_range(), mpd_run_noidle(), mpd_run_password(), mpd_run_rescan(), mpd_run_set_volume(), mpd_run_shuffle(), mpd_run_shuffle_range(), mpd_run_swap(), mpd_run_swap_id(), and mpd_run_update().

{
      struct mpd_pair *pair;

      if (mpd_error_is_defined(&connection->error))
            return false;

      if (connection->pair_state == PAIR_STATE_NULL)
            /* reset the stored NULL pair because it will conflict
               with an assertion within the loop */
            connection->pair_state = PAIR_STATE_NONE;

      while (connection->receiving) {
            assert(!mpd_error_is_defined(&connection->error));

            connection->discrete_finished = false;

            pair = mpd_recv_pair(connection);
            assert(pair != NULL || !connection->receiving ||
                   (connection->sending_command_list &&
                  connection->discrete_finished) ||
                   mpd_error_is_defined(&connection->error));

            if (pair != NULL)
                  mpd_return_pair(connection, pair);
      }

      return !mpd_error_is_defined(&connection->error);
}


Generated by  Doxygen 1.6.0   Back to index