summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Huerner <ingo.huerner@xse.de>2013-11-29 09:33:37 +0100
committerIngo Huerner <ingo.huerner@xse.de>2013-11-29 09:33:37 +0100
commitda863e2e60b23b1fd718b39e12a5ed26807dc752 (patch)
treee7b54f9e8e927cd91d031228aaf9a9e2ac07c31b
parentda2f989cf8754c30f9e4c4681b7165beb51c2997 (diff)
downloadpersistence-client-library-da863e2e60b23b1fd718b39e12a5ed26807dc752.tar.gz
Adjusted dbus message, removed transactions due to hight write traffic
-rw-r--r--src/persistence_client_library_db_access.c4
-rw-r--r--src/persistence_client_library_dbus_cmd.c62
-rw-r--r--src/persistence_client_library_dbus_service.c1
-rw-r--r--src/persistence_client_library_pas_interface.c19
4 files changed, 28 insertions, 58 deletions
diff --git a/src/persistence_client_library_db_access.c b/src/persistence_client_library_db_access.c
index 976fbdd..e974198 100644
--- a/src/persistence_client_library_db_access.c
+++ b/src/persistence_client_library_db_access.c
@@ -375,7 +375,7 @@ int pers_db_write_key(char* dbPath, char* key, PersistenceInfo_s* info, unsigned
{
// -----------------------------------------------------------------------------
// transaction start
- itzam_btree_transaction_start(btree);
+ // itzam_btree_transaction_start(btree);
// key
memset(insert.m_key, 0, DbKeySize);
@@ -400,7 +400,7 @@ int pers_db_write_key(char* dbPath, char* key, PersistenceInfo_s* info, unsigned
write_size = EPERS_DB_ERROR_INTERNAL;
}
- itzam_btree_transaction_commit(btree);
+ // itzam_btree_transaction_commit(btree);
// transaction end
// -----------------------------------------------------------------------------
diff --git a/src/persistence_client_library_dbus_cmd.c b/src/persistence_client_library_dbus_cmd.c
index c95a20d..c3f69af 100644
--- a/src/persistence_client_library_dbus_cmd.c
+++ b/src/persistence_client_library_dbus_cmd.c
@@ -220,9 +220,6 @@ void process_prepare_shutdown(unsigned char requestId, unsigned int status)
invalidate_custom_plugin(i);
}
}
-
- // notify lifecycle shutdown OK
- //send_prepare_shutdown_complete((int)requestId, (int)status);
}
@@ -230,7 +227,6 @@ void process_prepare_shutdown(unsigned char requestId, unsigned int status)
void process_send_pas_request(DBusConnection* conn, unsigned int requestID, int status)
{
DBusError error;
- DBusPendingCall* pending = NULL;
dbus_error_init (&error);
int rval = 0;
@@ -238,37 +234,31 @@ void process_send_pas_request(DBusConnection* conn, unsigned int requestID, int
"/org/genivi/persistence/admin", // path
"org.genivi.persistence.admin", // interface
"PersistenceAdminRequestCompleted"); // method
- if(message != NULL)
+ if(conn != NULL)
{
- dbus_message_append_args(message, DBUS_TYPE_UINT32, &requestID,
- DBUS_TYPE_INT32, &status,
- DBUS_TYPE_INVALID);
-
- if(conn != NULL)
+ if(message != NULL)
{
- //replyMsg = dbus_connection_send_with_reply_and_block(conn, message, gTimeoutMs, &error);
- dbus_connection_send_with_reply(conn, // the connection
- message, // the message to write
- &pending, // pending
- gTimeoutMs); // timeout in milliseconds or -1 for default
-
- dbus_connection_flush(conn);
+ dbus_message_append_args(message, DBUS_TYPE_UINT32, &requestID,
+ DBUS_TYPE_INT32, &status,
+ DBUS_TYPE_INVALID);
- if(!dbus_pending_call_set_notify(pending, msg_pending_func, "PersistenceAdminRequestCompleted", NULL))
+ if(!dbus_connection_send(conn, message, 0))
{
- DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("process_send_pas_request => dbus_pending_call_set_notify: FAILED\n"));
+ DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_register => Access denied"), DLT_STRING(error.message) );
+ rval = -1;
}
- dbus_pending_call_unref(pending);
+
+ dbus_connection_flush(conn);
+ dbus_message_unref(message);
}
else
{
- DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_pas_request => ERROR: Invalid connection") );
+ DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_pas_request => ERROR: Invalid message") );
}
- dbus_message_unref(message);
}
else
{
- DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_pas_request => ERROR: Invalid message") );
+ DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_pas_request => ERROR: Invalid connection") );
}
}
@@ -376,12 +366,12 @@ void process_send_lifecycle_register(DBusConnection* conn, int regType, int shut
DBUS_TYPE_UINT32, &shutdownMode, DBUS_TYPE_INVALID);
}
- if(!dbus_connection_send(conn, message, 0))
- {
- DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_register => Access denied"), DLT_STRING(error.message) );
- rval = -1;
- }
- dbus_connection_flush(conn);
+ if(!dbus_connection_send(conn, message, 0))
+ {
+ DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_register => Access denied"), DLT_STRING(error.message) );
+ rval = -1;
+ }
+ dbus_connection_flush(conn);
dbus_message_unref(message);
}
else
@@ -416,14 +406,14 @@ void process_send_lifecycle_request(DBusConnection* conn, int requestId, int sta
DBUS_TYPE_INVALID);
- if(!dbus_connection_send(conn, message, 0))
- {
- DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_request => Access denied"), DLT_STRING(error.message) );
- rval = -1;
- }
+ if(!dbus_connection_send(conn, message, 0))
+ {
+ DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_request => Access denied"), DLT_STRING(error.message) );
+ rval = -1;
+ }
- dbus_connection_flush(conn);
- dbus_message_unref(message);
+ dbus_connection_flush(conn);
+ dbus_message_unref(message);
}
else
{
diff --git a/src/persistence_client_library_dbus_service.c b/src/persistence_client_library_dbus_service.c
index 692e98b..486b04a 100644
--- a/src/persistence_client_library_dbus_service.c
+++ b/src/persistence_client_library_dbus_service.c
@@ -575,7 +575,6 @@ int mainLoop(DBusObjectPathVTable vtable, DBusObjectPathVTable vtable2,
case CMD_PAS_BLOCK_AND_WRITE_BACK:
process_block_and_write_data_back((buf[2]), buf[1]);
process_send_pas_request(conn, (buf[2]), buf[1]);
- pthread_mutex_lock(&gDbusPendingRegMtx); // block until pending received
break;
case CMD_LC_PREPARE_SHUTDOWN:
process_prepare_shutdown((buf[2]), buf[1]);
diff --git a/src/persistence_client_library_pas_interface.c b/src/persistence_client_library_pas_interface.c
index 28ac34f..1ca9a2b 100644
--- a/src/persistence_client_library_pas_interface.c
+++ b/src/persistence_client_library_pas_interface.c
@@ -259,22 +259,3 @@ int unregister_pers_admin_service(void)
return rval;
}
-
-/*
-int pers_admin_service_data_sync_complete(unsigned int requestID, unsigned int status)
-{
- int rval = 0;
-
- if(-1 == deliverToMainloop(CMD_SEND_PAS_REQUEST, status, requestID))
- {
- DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("pers_admin_service_data_sync_complete => failed to write to pipe"), DLT_INT(errno));
- rval = -1;
- }
- else
- {
- pthread_mutex_lock(&gDbusPendingRegMtx); // block until pending received
- rval = gDbusPendingRvalue;
- }
- return rval;
-}
-*/