MPD error handling.
More...
#include "dist/sds/sds.h"
#include "src/lib/api.h"
#include "src/lib/mympd_state.h"
Go to the source code of this file.
|
| void | mympd_set_mpd_failure (struct t_partition_state *partition_state, const char *errormessage) |
| |
| bool | mympd_check_error_and_recover (struct t_partition_state *partition_state, sds *error, const char *command) |
| |
| bool | mympd_check_error_and_recover_respond (struct t_partition_state *partition_state, sds *buffer, enum mympd_cmd_ids cmd_id, unsigned request_id, const char *command) |
| |
| bool | mympd_check_error_and_recover_notify (struct t_partition_state *partition_state, sds *buffer, const char *command) |
| |
| bool | mympd_check_error_and_recover_plain (struct t_partition_state *partition_state, sds *buffer, const char *command) |
| |
| sds | mympd_respond_with_error_or_ok (struct t_partition_state *partition_state, sds buffer, enum mympd_cmd_ids cmd_id, unsigned request_id, const char *command, bool *result) |
| |
| bool | mympd_clear_finish (struct t_partition_state *partition_state) |
| |
◆ mympd_check_error_and_recover()
| bool mympd_check_error_and_recover |
( |
struct t_partition_state * |
partition_state, |
|
|
sds * |
error, |
|
|
const char * |
command |
|
) |
| |
Checks for mpd protocol error and tries to recover it
- Parameters
-
| partition_state | pointer to partition specific states |
| error | pointer to an already allocated sds string for the error message or NULL |
| command | last mpd command |
- Returns
- true on success, else false
◆ mympd_check_error_and_recover_notify()
| bool mympd_check_error_and_recover_notify |
( |
struct t_partition_state * |
partition_state, |
|
|
sds * |
buffer, |
|
|
const char * |
command |
|
) |
| |
Checks for mpd protocol error and tries to recover it. Creates a jsonrpc notification on error.
- Parameters
-
| partition_state | pointer to partition specific states |
| buffer | already allocated sds string for the jsonrpc response or NULL |
| command | last mpd command |
- Returns
- true on success, else false
◆ mympd_check_error_and_recover_plain()
| bool mympd_check_error_and_recover_plain |
( |
struct t_partition_state * |
partition_state, |
|
|
sds * |
buffer, |
|
|
const char * |
command |
|
) |
| |
Checks for mpd protocol error and tries to recover it. Returns the plain mpd error message.
- Parameters
-
| partition_state | pointer to partition specific states |
| buffer | already allocated sds string for the mpd error message or NULL |
| command | last mpd command |
- Returns
- true on success, else false
◆ mympd_check_error_and_recover_respond()
| bool mympd_check_error_and_recover_respond |
( |
struct t_partition_state * |
partition_state, |
|
|
sds * |
buffer, |
|
|
enum mympd_cmd_ids |
cmd_id, |
|
|
unsigned |
request_id, |
|
|
const char * |
command |
|
) |
| |
Checks for mpd protocol error and tries to recover it. Creates a jsonrpc response on error.
- Parameters
-
| partition_state | pointer to partition specific states |
| buffer | pointer to an already allocated sds string for the jsonrpc response or NULL |
| cmd_id | enum mympd_cmd_ids |
| request_id | jsonrpc request id to respond |
| command | last mpd command |
- Returns
- true on success, else false
◆ mympd_clear_finish()
Silently clears a recoverable MPD error
- Parameters
-
| partition_state | Pointer to partition state |
- Returns
- true on success, else false
◆ mympd_respond_with_error_or_ok()
| sds mympd_respond_with_error_or_ok |
( |
struct t_partition_state * |
partition_state, |
|
|
sds |
buffer, |
|
|
enum mympd_cmd_ids |
cmd_id, |
|
|
unsigned |
request_id, |
|
|
const char * |
command, |
|
|
bool * |
result |
|
) |
| |
Checks for mpd protocol error and return code of last mpd command and tries to recover it. Creates always a jsonrpc response. Shortcut for mympd_check_rc_error_and_recover and jsonrpc_respond_ok
- Parameters
-
| partition_state | pointer to partition specific states |
| buffer | already allocated sds string for the jsonrpc response or NULL |
| cmd_id | enum mympd_cmd_ids |
| request_id | jsonrpc request id to respond |
| command | last mpd command |
| result | pointer to bool for result code |
- Returns
- pointer to buffer
◆ mympd_set_mpd_failure()
| void mympd_set_mpd_failure |
( |
struct t_partition_state * |
partition_state, |
|
|
const char * |
errormessage |
|
) |
| |
Public functions Sets the MPD_FAILURE state for the partition. myMPD disconnects and tries a reconnect.
- Parameters
-
| partition_state | Pointer to partition state |
| errormessage | Error message to log |