--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+
+#include <dlog.h>
+#include <download.h>
+#include <download-provider-interface.h>
+
+#define DEBUG_MSG
+#ifdef DEBUG_MSG
+#include <dlog.h>
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_URL_DOWNLOAD"
+#define TRACE_ERROR(format, ARG...) \
+{ \
+LOGE(format, ##ARG); \
+}
+#define TRACE_STRERROR(format, ARG...) \
+{ \
+LOGE(format" [%s]", ##ARG, strerror(errno)); \
+}
+#define TRACE_INFO(format, ARG...) \
+{ \
+LOGI(format, ##ARG); \
+}
+#else
+#define TRACE_DEBUG_MSG(format, ARG...) ;
+#endif
+
+/////////////////////// APIs /////////////////////////////////
+
+int download_create(int *download_id)
+{
+ TRACE_INFO("");
+ return dp_interface_create(download_id);
+}
+
+int download_destroy(int download_id)
+{
+ TRACE_INFO("");
+ return dp_interface_destroy(download_id);
+}
+
+int download_start(int download_id)
+{
+ TRACE_INFO("");
+ return dp_interface_start(download_id);
+}
+
+int download_pause(int download_id)
+{
+ TRACE_INFO("");
+ return dp_interface_pause(download_id);
+}
+
+int download_cancel(int download_id)
+{
+ TRACE_INFO("");
+ return dp_interface_cancel(download_id);
+}
+
+
+int download_set_url(int download_id, const char *url)
+{
+ TRACE_INFO("");
+ return dp_interface_set_url(download_id, url);
+}
+
+
+int download_get_url(int download_id, char **url)
+{
+ TRACE_INFO("");
+ return dp_interface_get_url(download_id, url);
+}
+
+int download_set_network_type(int download_id,
+ download_network_type_e net_type)
+{
+ TRACE_INFO("");
+ return dp_interface_set_network_type(download_id, (int)net_type);
+}
+
+int download_get_network_type(int download_id,
+ download_network_type_e *net_type)
+{
+ TRACE_INFO("");
+
+ int network_type = DOWNLOAD_ADAPTOR_NETWORK_ALL;
+ int ret = dp_interface_get_network_type(download_id, &network_type);
+ if (ret == DOWNLOAD_ADAPTOR_ERROR_NONE)
+ *net_type = network_type;
+ return ret;
+}
+
+int download_set_destination(int download_id, const char *path)
+{
+ TRACE_INFO("");
+ return dp_interface_set_destination(download_id, path);
+}
+
+
+int download_get_destination(int download_id, char **path)
+{
+ TRACE_INFO("");
+ return dp_interface_get_destination(download_id, path);
+}
+
+int download_set_file_name(int download_id, const char *file_name)
+{
+ TRACE_INFO("");
+ return dp_interface_set_file_name(download_id, file_name);
+}
+
+int download_get_file_name(int download_id, char **file_name)
+{
+ TRACE_INFO("");
+ return dp_interface_get_file_name(download_id, file_name);
+}
+
+int download_set_ongoing_notification(int download_id, bool enable)
+{
+ return download_set_notification(download_id, enable);
+}
+
+int download_set_notification(int download_id, bool enable)
+{
+ TRACE_INFO("");
+ return dp_interface_set_notification(download_id, (int)enable);
+}
+
+int download_get_ongoing_notification(int download_id, bool *enable)
+{
+ return download_get_notification(download_id, enable);
+}
+
+int download_get_notification(int download_id, bool *enable)
+{
+ int is_set = 0;
+
+ TRACE_INFO("");
+ int ret = dp_interface_get_notification(download_id, &is_set);
+ if (ret == DOWNLOAD_ADAPTOR_ERROR_NONE)
+ *enable = (bool)is_set;
+ return ret;
+}
+
+int download_get_downloaded_file_path(int download_id, char **path)
+{
+ TRACE_INFO("");
+ return dp_interface_get_downloaded_file_path(download_id, path);
+}
+
+int download_add_notification_extra_param(
+ int download_id, const char *key,
+ const char **value, const unsigned int length)
+{
+ TRACE_INFO("");
+ return dp_interface_add_noti_extra(download_id, key, value, length);
+}
+
+int download_remove_notification_extra_param(int download_id, const char *key)
+{
+ TRACE_INFO("");
+ return dp_interface_remove_noti_extra_key(download_id, key);
+}
+
+int download_get_notification_extra_param(
+ int download_id, const char *key,
+ char ***values, unsigned int *length)
+{
+ TRACE_INFO("");
+ return dp_interface_get_noti_extra_values(download_id, key, values, length);
+}
+
+int download_add_http_header_field(int download_id, const char *field,
+ const char *value)
+{
+ TRACE_INFO("");
+ return
+ dp_interface_add_http_header_field(download_id, field, value);
+}
+
+int download_get_http_header_field(int download_id,
+ const char *field, char **value)
+{
+ TRACE_INFO("");
+ return
+ dp_interface_get_http_header_field(download_id, field, value);
+}
+
+int download_remove_http_header_field(int download_id,
+ const char *field)
+{
+ TRACE_INFO("");
+ return dp_interface_remove_http_header_field(download_id, field);
+}
+
+// download_state_changed_cb is different with dp_interface_state_changed_cb.
+int download_set_state_changed_cb(int download_id,
+ download_state_changed_cb callback, void* user_data)
+{
+ TRACE_INFO("");
+ return dp_interface_set_state_changed_cb(download_id,
+ (dp_interface_state_changed_cb)callback, user_data);
+}
+
+int download_unset_state_changed_cb(int download_id)
+{
+ TRACE_INFO("");
+ return dp_interface_unset_state_changed_cb(download_id);
+}
+
+// download_progress_cb is same with dp_interface_progress_cb.
+int download_set_progress_cb(int download_id,
+ download_progress_cb callback, void *user_data)
+{
+ TRACE_INFO("");
+ return dp_interface_set_progress_cb(download_id,
+ (dp_interface_progress_cb)callback, user_data);
+}
+
+int download_unset_progress_cb(int download_id)
+{
+ TRACE_INFO("");
+ return dp_interface_unset_progress_cb(download_id);
+}
+
+int download_get_state(int download_id, download_state_e *state)
+{
+ int statecode = 0;
+
+ TRACE_INFO("");
+ int ret = dp_interface_get_state(download_id, &statecode);
+ if (ret == DOWNLOAD_ADAPTOR_ERROR_NONE)
+ *state = statecode;
+ return ret;
+}
+
+int download_get_temp_path(int download_id, char **temp_path)
+{
+ TRACE_INFO("");
+ return dp_interface_get_temp_path(download_id, temp_path);
+}
+
+int download_get_content_name(int download_id, char **content_name)
+{
+ TRACE_INFO("");
+ return dp_interface_get_content_name(download_id, content_name);
+}
+
+int download_get_content_size(int download_id,
+ unsigned long long *content_size)
+{
+ TRACE_INFO("");
+ return dp_interface_get_content_size(download_id, content_size);
+}
+
+int download_get_mime_type(int download_id, char **mime_type)
+{
+ TRACE_INFO("");
+ return dp_interface_get_mime_type(download_id, mime_type);
+}
+
+int download_set_auto_download(int download_id, bool enable)
+{
+ TRACE_INFO("");
+ return dp_interface_set_auto_download(download_id, (int)enable);
+}
+
+int download_get_auto_download(int download_id, bool *enable)
+{
+ int is_set = 0;
+
+ TRACE_INFO("");
+ int ret = dp_interface_get_auto_download(download_id, &is_set);
+ if (ret == DOWNLOAD_ADAPTOR_ERROR_NONE)
+ *enable = (bool)is_set;
+ return ret;
+}
+
+int download_get_error(int download_id, download_error_e *error)
+{
+ int errorcode = 0;
+
+ TRACE_INFO("");
+ int ret = dp_interface_get_error(download_id, &errorcode);
+ if (ret == DOWNLOAD_ADAPTOR_ERROR_NONE)
+ *error = errorcode;
+ return ret;
+}
+
+int download_get_http_status(int download_id, int *http_status)
+{
+ TRACE_INFO("");
+ return dp_interface_get_http_status(download_id, http_status);
+}
+
#include <download.h>
#include <download-provider.h>
-#ifdef DP_ECHO_TEST
-#define DOWNLOAD_ECHO_SUPPORT
+#ifdef DP_DBUS_ACTIVATION
+#include <dbus/dbus.h>
#endif
-#ifdef DOWNLOAD_ECHO_SUPPORT
+
+#ifdef DP_ECHO_TEST
#include <sys/ioctl.h>
#endif
-#ifdef DP_DBUS_ACTIVATION
-#include <dbus/dbus.h>
-#endif
+#define DP_CHECK_PROVIDER_STATUS do {\
+ if (__check_ipc_status(g_download_ipc->cmd_socket) < 0) {\
+ pthread_mutex_unlock((&g_download_ipc->mutex));\
+ pthread_mutex_unlock(&g_download_mutex);\
+ if (errno != EAGAIN && errno != EINTR)\
+ _disconnect_from_provider();\
+ return DOWNLOAD_ERROR_IO_ERROR;\
+ }\
+} while(0)
#define MAX_DOWNLOAD_HANDLE 5
default:
break;
}
- return DOWNLOAD_ERROR_NONE;
+ return DOWNLOAD_STATE_NONE;
}
void _download_print_str_state(int state)
if (errno == EPIPE) {
TRACE_INFO("[EPIPE] Broken Pipe errno [%d]", errno);
} else if (errno == EAGAIN) {
- TRACE_INFO("[EAGAIN] Resource temporarily unavailable errno [%d]", errno);
+ TRACE_INFO
+ ("[EAGAIN] Resource temporarily unavailable errno [%d]",
+ errno);
+ } else if (errno == EINTR) {
+ TRACE_ERROR("[EINTR] Interrupted System Call");
} else {
TRACE_INFO("errno [%d]", errno);
}
return DOWNLOAD_ERROR_NONE;
}
-#ifdef DOWNLOAD_ECHO_SUPPORT
+#ifdef DP_ECHO_TEST
// clear read buffer. call in head of API before calling IPC_SEND
-void __clear_read_buffer(int fd)
+static void __clear_read_buffer(int fd)
{
long i;
long unread_count;
}
}
}
+#endif
// ask to provider before sending a command.
// if provider wait in some commnad, can not response immediately
// capi will wait in read block.
// after asking, call clear_read_buffer.
-
-
-int _check_ipc_status(int fd)
+static int __check_ipc_status(int fd)
{
+#ifdef DP_ECHO_TEST
// echo from provider
download_error_e errorcode = _send_simple_cmd(-1, DP_CMD_ECHO);
if (errorcode != DOWNLOAD_ERROR_NONE) {
TRACE_INFO("[EAGAIN] provider is busy");
} else {
TRACE_INFO("[CRITICAL] Broken Socket");
- _disconnect_from_provider();
}
return -1;
}
}
__clear_read_buffer(fd);
+#endif
return 0;
}
-#endif
// listen ASYNC state event, no timeout
void *_download_event_manager(void *arg)
free(eventinfo);
TRACE_STRERROR("[CRITICAL] Can not read Event packet");
pthread_mutex_unlock(&g_download_mutex);
- if (errno != EAGAIN) // if not timeout. end thread
+ if (errno != EAGAIN && errno != EINTR) // if not timeout. end thread
break;
continue;
}
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode = _send_simple_cmd(-1, DP_CMD_CREATE);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
t_download_id = _download_ipc_read_int(g_download_ipc->cmd_socket);
if (t_download_id < 0) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return DOWNLOAD_ERROR_IO_ERROR;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
index = _get_my_slot_index(download_id);
if (index >= 0) {
errorcode = _send_simple_cmd(download_id, DP_CMD_DESTROY);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode = _send_simple_cmd(download_id, DP_CMD_START);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode = _send_simple_cmd(download_id, DP_CMD_PAUSE);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode = _send_simple_cmd(download_id, DP_CMD_CANCEL);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
// send commnad with ID
if (_download_ipc_send_command
if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
TRACE_ERROR("[CHECK IO] (%d)", download_id);
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode = _send_simple_cmd(download_id, DP_CMD_GET_URL);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
value = _ipc_read_string(g_download_ipc->cmd_socket);
if (value == NULL) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return DOWNLOAD_ERROR_IO_ERROR;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
if (_download_ipc_send_command(g_download_ipc->cmd_socket,
download_id, DP_CMD_SET_NETWORK_TYPE)
if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
TRACE_ERROR("[CHECK IO] (%d)", download_id);
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode = _send_simple_cmd(download_id, DP_CMD_GET_NETWORK_TYPE);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
network_type = _download_ipc_read_int(g_download_ipc->cmd_socket);
if (network_type < 0) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return DOWNLOAD_ERROR_IO_ERROR;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
// send commnad with ID
if (_download_ipc_send_command
if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
TRACE_ERROR("[CHECK IO] (%d)", download_id);
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode =
_send_simple_cmd(download_id, DP_CMD_GET_DESTINATION);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
value = _ipc_read_string(g_download_ipc->cmd_socket);
if (value == NULL) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return DOWNLOAD_ERROR_IO_ERROR;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
// send commnad with ID
if (_download_ipc_send_command
if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
TRACE_ERROR("[CHECK IO] (%d)", download_id);
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode =
_send_simple_cmd(download_id, DP_CMD_GET_FILENAME);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
value = _ipc_read_string(g_download_ipc->cmd_socket);
if (value == NULL) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return DOWNLOAD_ERROR_IO_ERROR;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
if (_download_ipc_send_command(g_download_ipc->cmd_socket,
download_id, DP_CMD_SET_NOTIFICATION)
if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
TRACE_ERROR("[CHECK IO] (%d)", download_id);
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode = _send_simple_cmd(download_id, DP_CMD_GET_NOTIFICATION);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
value = _download_ipc_read_int(g_download_ipc->cmd_socket);
if (value < 0) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return DOWNLOAD_ERROR_IO_ERROR;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode =
_send_simple_cmd(download_id, DP_CMD_GET_SAVED_PATH);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
value = _ipc_read_string(g_download_ipc->cmd_socket);
if (value == NULL) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return DOWNLOAD_ERROR_IO_ERROR;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
// send commnad with ID
if (_download_ipc_send_command
if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
TRACE_ERROR("[CHECK IO] (%d)", download_id);
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode = _send_simple_cmd(download_id, DP_CMD_GET_EXTRA_PARAM);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
key_str = _ipc_read_string(g_download_ipc->cmd_socket);
if (key_str == NULL) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return DOWNLOAD_ERROR_IO_ERROR;
value_str = _ipc_read_string(g_download_ipc->cmd_socket);
if (value_str == NULL) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
free(key_str);
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
// send commnad with ID
if (_download_ipc_send_command
if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
TRACE_ERROR("[CHECK IO] (%d)", download_id);
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
if (_download_ipc_send_command
(g_download_ipc->cmd_socket, download_id, DP_CMD_GET_HTTP_HEADER)
if (errorcode != DOWNLOAD_ERROR_NONE) {
TRACE_ERROR("[CHECK IO] (%d)", download_id);
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
str = _ipc_read_string(g_download_ipc->cmd_socket);
if (str == NULL) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return DOWNLOAD_ERROR_IO_ERROR;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
// send commnad with ID
if (_download_ipc_send_command
if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
TRACE_ERROR("[CHECK IO] (%d)", download_id);
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
// turn on state_cb flag of provider
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
+
// send create command.
if (_download_ipc_send_command(g_download_ipc->cmd_socket,
download_id, DP_CMD_SET_STATE_CALLBACK)
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
index = _get_my_slot_index(download_id);
if (index >= 0) {
if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
TRACE_ERROR("[CHECK IO] (%d)", download_id);
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
// turn on progress_cb flag of provider
// send create command.
if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
TRACE_ERROR("[CHECK IO] (%d)", download_id);
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
download_unset_progress_cb(download_id);
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
index = _get_my_slot_index(download_id);
if (index >= 0) {
if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
TRACE_ERROR("[CHECK IO] (%d)", download_id);
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode = _send_simple_cmd(download_id, DP_CMD_GET_STATE);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
if (_ipc_read_custom_type(g_download_ipc->cmd_socket,
&dp_state, sizeof(dp_state_type)) < 0) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return DOWNLOAD_ERROR_IO_ERROR;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode =
_send_simple_cmd(download_id, DP_CMD_GET_TEMP_SAVED_PATH);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
value = _ipc_read_string(g_download_ipc->cmd_socket);
if (value == NULL) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return DOWNLOAD_ERROR_IO_ERROR;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode = _send_simple_cmd(download_id, DP_CMD_GET_CONTENT_NAME);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
value = _ipc_read_string(g_download_ipc->cmd_socket);
if (value == NULL) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return DOWNLOAD_ERROR_IO_ERROR;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode = _send_simple_cmd(download_id, DP_CMD_GET_TOTAL_FILE_SIZE);
if (errorcode != DOWNLOAD_ERROR_NONE) {
content_size, sizeof(unsigned long long));
if (errorcode < 0) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode = _send_simple_cmd(download_id, DP_CMD_GET_MIME_TYPE);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
value = _ipc_read_string(g_download_ipc->cmd_socket);
if (value == NULL) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return DOWNLOAD_ERROR_IO_ERROR;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
if (_download_ipc_send_command(g_download_ipc->cmd_socket,
download_id, DP_CMD_SET_AUTO_DOWNLOAD)
if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
TRACE_ERROR("[CHECK IO] (%d)", download_id);
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode = _send_simple_cmd(download_id, DP_CMD_GET_AUTO_DOWNLOAD);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
value = _download_ipc_read_int(g_download_ipc->cmd_socket);
if (value < 0) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return DOWNLOAD_ERROR_IO_ERROR;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode = _send_simple_cmd(download_id, DP_CMD_GET_ERROR);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
TRACE_ERROR("[CHECK IO] (%d)", download_id);
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
pthread_mutex_lock((&g_download_ipc->mutex));
-#ifdef DOWNLOAD_ECHO_SUPPORT
- if (_check_ipc_status(g_download_ipc->cmd_socket) < 0) {
- pthread_mutex_unlock((&g_download_ipc->mutex));
- pthread_mutex_unlock(&g_download_mutex);
- return DOWNLOAD_ERROR_IO_ERROR;
- }
-#endif
+ DP_CHECK_PROVIDER_STATUS;
errorcode = _send_simple_cmd(download_id, DP_CMD_GET_HTTP_STATUS);
if (errorcode != DOWNLOAD_ERROR_NONE) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errorcode == DOWNLOAD_ERROR_IO_ERROR && errno != EAGAIN)
- _disconnect_from_provider();
+ if (errorcode == DOWNLOAD_ERROR_IO_ERROR) {
+ if (errno != EAGAIN && errno != EINTR)
+ _disconnect_from_provider();
+ }
pthread_mutex_unlock(&g_download_mutex);
return errorcode;
}
status = _download_ipc_read_int(g_download_ipc->cmd_socket);
if (status < 0) {
pthread_mutex_unlock((&g_download_ipc->mutex));
- if (errno != EAGAIN)
+ if (errno != EAGAIN && errno != EINTR)
_disconnect_from_provider();
pthread_mutex_unlock(&g_download_mutex);
return DOWNLOAD_ERROR_IO_ERROR;