summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2012-07-23 17:09:43 +0900
committerSung-jae Park <nicesj.park@samsung.com>2012-07-24 13:30:33 +0900
commit3c31514550d4437b669ec43b89e9f543a8edb6b2 (patch)
treeb535fc14af31b03910dc5fafe2c46229a110b38c
parent0f5c51daf10342d9c1aa209dbc7bd7c7ccffb9e5 (diff)
downloadcom-core-3c31514550d4437b669ec43b89e9f543a8edb6b2.tar.gz
com-core-3c31514550d4437b669ec43b89e9f543a8edb6b2.tar.bz2
com-core-3c31514550d4437b669ec43b89e9f543a8edb6b2.zip
Add -g option for generating strip binary correctly
Add timeout parameter for async_send Change-Id: I837dacccdf65122d2905108ef69d36185ed2a4b7
-rw-r--r--CMakeLists.txt2
-rw-r--r--debian/changelog7
-rw-r--r--include/com-core_packet.h2
-rw-r--r--packaging/libcom-core.spec2
-rw-r--r--src/com-core_packet.c27
5 files changed, 36 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1f2d967..60cc4c4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,7 +24,7 @@ FOREACH(flag ${pkgs_CFLAGS})
ENDFOREACH(flag)
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g")
ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
ADD_DEFINITIONS("-DLOG_TAG=\"${PROJECT_NAME}\"")
diff --git a/debian/changelog b/debian/changelog
index d20bcc2..b9fbb52 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+com-core (0.0.5) unstable; urgency=low
+
+ * Git: slp/pkgs/c/com-core
+ * Tag: com-core_0.0.5
+
+ -- Sung-jae Park <nicesj.park@samsung.com> Tue, 24 Jul 2012 13:30:04 +0900
+
com-core (0.0.4) unstable; urgency=low
* Git: slp/pkgs/c/com-core
diff --git a/include/com-core_packet.h b/include/com-core_packet.h
index 2625b66..280e5ce 100644
--- a/include/com-core_packet.h
+++ b/include/com-core_packet.h
@@ -7,7 +7,7 @@ struct method {
struct packet *(*handler)(pid_t pid, int handle, const struct packet *packet);
};
-extern int com_core_packet_async_send(int handle, struct packet *packet, int (*recv_cb)(pid_t, int handle, const struct packet *packet, void *data), void *data);
+extern int com_core_packet_async_send(int handle, struct packet *packet, unsigned int timeout, int (*recv_cb)(pid_t, int handle, const struct packet *packet, void *data), void *data);
extern int com_core_packet_send_only(int handle, struct packet *packet);
extern struct packet *com_core_packet_oneshot_send(const char *addr, struct packet *packet);
diff --git a/packaging/libcom-core.spec b/packaging/libcom-core.spec
index f7a6f1f..3da793f 100644
--- a/packaging/libcom-core.spec
+++ b/packaging/libcom-core.spec
@@ -1,6 +1,6 @@
Name: libcom-core
Summary: Library for the light-weight IPC
-Version: 0.0.4
+Version: 0.0.5
Release: 1
Group: main/util
License: Samsung Proprietary License
diff --git a/src/com-core_packet.c b/src/com-core_packet.c
index 7fc7ce2..6135146 100644
--- a/src/com-core_packet.c
+++ b/src/com-core_packet.c
@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <fcntl.h>
+#include <glib.h>
#include <dlog.h>
#include "debug.h"
@@ -32,6 +33,8 @@ struct request_ctx {
struct packet *packet;
int (*recv_cb)(pid_t pid, int handle, const struct packet *packet, void *data);
void *data;
+
+ guint timeout;
};
struct recv_ctx {
@@ -63,6 +66,9 @@ static inline struct request_ctx *find_request_ctx(int handle, unsigned long seq
static inline void destroy_request_ctx(struct request_ctx *ctx)
{
+ if (ctx->timeout > 0)
+ g_source_remove(ctx->timeout);
+
packet_unref(ctx->packet);
dlist_remove_data(s_info.request_list, ctx);
free(ctx);
@@ -336,7 +342,21 @@ static int service_cb(int handle, int readsize, void *data)
return 0;
}
-EAPI int com_core_packet_async_send(int handle, struct packet *packet, int (*recv_cb)(pid_t pid, int handle, const struct packet *packet, void *data), void *data)
+static gboolean timeout_cb(gpointer data)
+{
+ struct request_ctx *ctx = data;
+
+ ErrPrint("Timeout (Not responding in time)\n");
+
+ if (ctx->recv_cb)
+ ctx->recv_cb(ctx->pid, ctx->handle, NULL, ctx->data);
+
+ ctx->timeout = 0u;
+ destroy_request_ctx(ctx);
+ return FALSE;
+}
+
+EAPI int com_core_packet_async_send(int handle, struct packet *packet, unsigned int timeout, int (*recv_cb)(pid_t pid, int handle, const struct packet *packet, void *data), void *data)
{
int ret;
struct request_ctx *ctx;
@@ -348,6 +368,11 @@ EAPI int com_core_packet_async_send(int handle, struct packet *packet, int (*rec
ctx->recv_cb = recv_cb;
ctx->data = data;
ctx->packet = packet_ref(packet);
+ if (timeout > 0) {
+ ctx->timeout = g_timeout_add(timeout, timeout_cb, ctx);
+ if (ctx->timeout == 0)
+ ErrPrint("Failed to add timeout\n");
+ }
ret = secure_socket_send(handle, (void *)packet_data(packet), packet_size(packet));
if (ret != packet_size(packet)) {