/*
* Copyright 2013 Samsung Electronics Co., Ltd
*
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
void *data;
enum {
TYPE_ACK,
- TYPE_NOACK,
+ TYPE_NOACK
} type;
};
struct command *command;
l = dlist_nth(s_info.cmd_list, 0);
- if (!l)
+ if (!l) {
return NULL;
+ }
command = dlist_data(l);
s_info.cmd_list = dlist_remove(s_info.cmd_list, l);
* increate the reference counter of the item->param
*/
if (command->type == TYPE_NOACK) {
- if (com_core_packet_send_only(client_fd(), command->packet) < 0)
+ if (com_core_packet_send_only(client_fd(), command->packet) < 0) {
ErrPrint("Failed to send a packet to master\n");
+ }
destroy_command(command);
} else {
if (com_core_packet_async_send(client_fd(), command->packet, 0u, done_cb, command) < 0) {
- DbgPrint("Failed to send a packet to master\n");
- if (command->ret_cb)
+ ErrPrint("Failed to send a packet to master\n");
+ if (command->ret_cb) {
command->ret_cb(command->handler, NULL, command->data);
+ }
destroy_command(command);
}
}
void master_rpc_check_and_fire_consumer(void)
{
- if (!s_info.cmd_list || s_info.cmd_timer || client_fd() < 0)
+ if (!s_info.cmd_list || s_info.cmd_timer || client_fd() < 0) {
return;
+ }
s_info.cmd_timer = g_timeout_add(REQUEST_DELAY, cmd_consumer, NULL);
- if (!s_info.cmd_timer)
+ if (!s_info.cmd_timer) {
ErrPrint("Failed to add timer\n");
+ }
}
static int done_cb(pid_t pid, int handle, const struct packet *packet, void *data)
ret = LB_STATUS_ERROR_INVALID;
}
- DbgPrint("[%s] Returns: %d\n", packet_command(packet), ret);
-
out:
- if (command->ret_cb)
+ if (command->ret_cb) {
command->ret_cb(command->handler, packet, command->data);
+ }
destroy_command(command);
return 0;
command->ttl = DEFAULT_TTL;
command->type = TYPE_ACK;
- if (urgent)
+ if (urgent) {
prepend_command(command);
- else
+ } else {
push_command(command);
+ }
packet_unref(packet);
return LB_STATUS_SUCCESS;
struct dlist *n;
struct command *command;
- if (!pkgname)
+ if (!pkgname) {
return LB_STATUS_ERROR_INVALID;
-
- DbgPrint("Clear requests of the fault package(%s)\n", pkgname);
+ }
dlist_foreach_safe(s_info.cmd_list, l, n, command) {
- if (!command->handler)
+ if (!command->handler) {
continue;
+ }
if (!strcmp(command->handler->pkgname, pkgname)) {
s_info.cmd_list = dlist_remove(s_info.cmd_list, l);
- if (command->ret_cb)
+ if (command->ret_cb) {
command->ret_cb(command->handler, NULL, command->data);
+ }
destroy_command(command);
}
struct dlist *l;
struct dlist *n;
- DbgPrint("Clear all pended requests\n");
-
dlist_foreach_safe(s_info.cmd_list, l, n, command) {
s_info.cmd_list = dlist_remove(s_info.cmd_list, l);
- if (command->ret_cb)
+ if (command->ret_cb) {
command->ret_cb(command->handler, NULL, command->data);
+ }
destroy_command(command);
}