&& dp_notification_manager_push_notification((void *)&clients[slot_index], (void *)request, DP_NOTIFICATION_ONGOING) < 0)
TRACE_ERROR("failed to register notification for id:%d", request->id);
}
-
slot_index++;
} else {
break;
}
case DP_PROP_PROXY:
- {
- char *string = NULL;
- unsigned length = 0;
- if (dp_db_get_property_string(client->dbhandle, ipc_info->id, DP_TABLE_REQUEST, DP_DB_COL_PROXY, (unsigned char **)&string, &length, &errorcode) < 0) {
- TRACE_ERROR("failed to get %s", dp_print_property(ipc_info->property));
- errorcode = DP_ERROR_NO_DATA;
- }
- int result = __dp_request_feedback_string(client->channel, ipc_info, string, length, errorcode);
- if (result == DP_ERROR_IO_ERROR) {
- errorcode = DP_ERROR_IO_ERROR;
- TRACE_ERROR("check ipc sock:%d", client->channel);
+ {
+ char *string = NULL;
+ unsigned length = 0;
+ if (dp_db_get_property_string(client->dbhandle, ipc_info->id, DP_TABLE_REQUEST, DP_DB_COL_PROXY, (unsigned char **)&string, &length, &errorcode) < 0) {
+ TRACE_ERROR("failed to get %s", dp_print_property(ipc_info->property));
+ errorcode = DP_ERROR_NO_DATA;
+ }
+ int result = __dp_request_feedback_string(client->channel, ipc_info, string, length, errorcode);
+ if (result == DP_ERROR_IO_ERROR) {
+ errorcode = DP_ERROR_IO_ERROR;
+ TRACE_ERROR("check ipc sock:%d", client->channel);
+ }
+ free(string);
+ break;
}
- free(string);
- break;
- }
case DP_PROP_DESTINATION:
{
char *string = NULL;
break;
}
case DP_PROP_PROXY:
- {
- char *recv_str = NULL;
- errorcode = __dp_request_read_string(client->channel, ipc_info, &recv_str);
- if (errorcode == DP_ERROR_NONE) {
- if (recv_str == NULL) {
- errorcode = DP_ERROR_INVALID_PARAMETER;
- } else {
- // write to database here
- if (dp_db_replace_property(client->dbhandle, ipc_info->id, DP_TABLE_REQUEST, DP_DB_COL_PROXY, (void *)recv_str, ipc_info->size, 2, &errorcode) < 0) {
- TRACE_ERROR("failed to set %s errorcode:%s", dp_print_property(ipc_info->property), dp_print_errorcode(errorcode));
+ {
+ char *recv_str = NULL;
+ errorcode = __dp_request_read_string(client->channel, ipc_info, &recv_str);
+ if (errorcode == DP_ERROR_NONE) {
+ if (recv_str == NULL) {
+ errorcode = DP_ERROR_INVALID_PARAMETER;
+ } else {
+ // write to database here
+ if (dp_db_replace_property(client->dbhandle, ipc_info->id, DP_TABLE_REQUEST, DP_DB_COL_PROXY, (void *)recv_str, ipc_info->size, 2, &errorcode) < 0)
+ TRACE_ERROR("failed to set %s errorcode:%s", dp_print_property(ipc_info->property), dp_print_errorcode(errorcode));
+ free(recv_str);
}
- free(recv_str);
}
+ break;
}
- break;
- }
case DP_PROP_DESTINATION:
{
char *recv_str = NULL;
TRACE_ERROR("failed to unset %s", dp_print_property(ipc_info->property));
break;
case DP_PROP_PROXY:
- if (dp_db_unset_property_string(client->dbhandle, ipc_info->id, DP_TABLE_REQUEST, DP_DB_COL_PROXY, &errorcode) < 0) {
+ if (dp_db_unset_property_string(client->dbhandle, ipc_info->id, DP_TABLE_REQUEST, DP_DB_COL_PROXY, &errorcode) < 0)
TRACE_ERROR("failed to unset %s errorcode:%s", dp_print_property(ipc_info->property), dp_print_errorcode(errorcode));
- }
break;
case DP_PROP_DESTINATION:
// if downloading, change destination to da_agent
* limitations under the License.
*/
+#define _GNU_SOURCE
+#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <pthread.h>
#include <systemd/sd-daemon.h>
#include <glib-object.h>
curl_global_cleanup();
return 0;
} else {
+ pthread_setname_np(g_client_manager_tid, "dp-client-mgr");
pthread_detach(g_client_manager_tid);
TRACE_INFO("download main thread is created[%lu]", g_client_manager_tid);
}
network_type = DP_NETWORK_ALL;
TRACE_INFO("COMPANION MODE");
} else if (type == CONNECTION_TYPE_WIFI) {
- connection_wifi_state_e wifi_state;
- wifi_state = CONNECTION_WIFI_STATE_DEACTIVATED;
- if (connection_get_wifi_state(connection, &wifi_state) !=
- CONNECTION_ERROR_NONE) {
- TRACE_ERROR("Failed connection_get_wifi_state");
- } else {
- if (wifi_state == CONNECTION_WIFI_STATE_CONNECTED) {
- TRACE_INFO("WIFI CONNECTED");
- network_type = DP_NETWORK_WIFI;
- }
- }
+ TRACE_INFO("WIFI CONNECTED");
+ network_type = DP_NETWORK_WIFI;
} else if (type == CONNECTION_TYPE_CELLULAR) {
- connection_cellular_state_e cellular_state;
- cellular_state = CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE;
- if (connection_get_cellular_state(connection,
- &cellular_state) != CONNECTION_ERROR_NONE) {
- TRACE_ERROR("Failed connection_get_cellular_state");
- } else {
- if (cellular_state == CONNECTION_CELLULAR_STATE_CONNECTED) {
- TRACE_INFO("DATA NETWORK CONNECTED");
- network_type = DP_NETWORK_DATA_NETWORK;
- }
- }
+ TRACE_INFO("DATA NETWORK CONNECTED");
+ network_type = DP_NETWORK_DATA_NETWORK;
} else if (type == CONNECTION_TYPE_ETHERNET) {
- connection_ethernet_state_e ethernet_state;
- ethernet_state = CONNECTION_ETHERNET_STATE_DISCONNECTED;
- if (connection_get_ethernet_state(connection,
- ðernet_state) != CONNECTION_ERROR_NONE) {
- TRACE_ERROR("Failed connection_get_ethernet_state");
- } else {
- if (ethernet_state == CONNECTION_ETHERNET_STATE_CONNECTED) {
- TRACE_INFO("ETHERNET CONNECTED");
- network_type = DP_NETWORK_WIFI;
- }
- }
+ TRACE_INFO("ETHERNET CONNECTED");
+ network_type = DP_NETWORK_WIFI;
+ } else if (type == CONNECTION_TYPE_BT) {
+ TRACE_INFO("BT CONNECTED");
+ network_type = DP_NETWORK_WIFI;
+ } else if (type == CONNECTION_TYPE_NET_PROXY) {
+ TRACE_INFO("NET PROXY CONNECTED");
+ network_type = DP_NETWORK_WIFI;
} else {
TRACE_INFO("DISCONNECTED");
network_type = DP_NETWORK_OFF;
char *url = NULL;
unsigned int len = 0;
if (CLIENT_MUTEX_CHECKLOCK(&slot->mutex) == 0) {
- if (dp_db_get_property_string(slot->client.dbhandle, download_id, DP_TABLE_REQUEST, DP_DB_COL_URL, (unsigned char **)&url, &len, &errorcode) < 0) {
+ if (dp_db_get_property_string(slot->client.dbhandle, download_id, DP_TABLE_REQUEST, DP_DB_COL_URL, (unsigned char **)&url, &len, &errorcode) < 0)
TRACE_ERROR("failed to get url id:%d error:%s", download_id, dp_print_errorcode(errorcode));
- }
CLIENT_MUTEX_UNLOCK(&slot->mutex);
}
if (url != NULL) {
err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_CONTENT, url, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
if (err != NOTIFICATION_ERROR_NONE)
- {
TRACE_ERROR("failed to set url error:%s", __dp_noti_error_str(err));
- }
}