summaryrefslogtreecommitdiffstats
path: root/src/Daemon/CommLayerServerDBus.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-09-08 13:16:06 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-09-08 13:16:06 +0200
commita4257108013f15653724b5ed3b3c208e071567c5 (patch)
tree456d43971be209e777fce616ac149d0032c90452 /src/Daemon/CommLayerServerDBus.cpp
parent5d2fb8bf5ebdf814259a01c6e429311334d2eabc (diff)
downloadabrt-a4257108013f15653724b5ed3b3c208e071567c5.tar.gz
abrt-a4257108013f15653724b5ed3b3c208e071567c5.tar.xz
abrt-a4257108013f15653724b5ed3b3c208e071567c5.zip
abrtd: eliminate g_pending_jobs[] map and all corresponding TODOs :)
-6k: text data bss dec hexfilename 194741 2656 2384 199781 30c65abrt.t1/abrt-0.0.8.5/src/Daemon/.libs/abrtd 188316 2648 2320 193284 2f304abrt.t2/abrt-0.0.8.5/src/Daemon/.libs/abrtd Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src/Daemon/CommLayerServerDBus.cpp')
-rw-r--r--src/Daemon/CommLayerServerDBus.cpp82
1 files changed, 42 insertions, 40 deletions
diff --git a/src/Daemon/CommLayerServerDBus.cpp b/src/Daemon/CommLayerServerDBus.cpp
index 41f5abab..1be957b8 100644
--- a/src/Daemon/CommLayerServerDBus.cpp
+++ b/src/Daemon/CommLayerServerDBus.cpp
@@ -367,31 +367,32 @@ void CCommLayerServerDBus::Crash(const std::string& progname, const std::string&
send_flush_and_unref(msg);
}
-void CCommLayerServerDBus::JobDone(const char* pDest, uint64_t job_id)
+void CCommLayerServerDBus::JobStarted(const char* pDest)
{
- DBusMessage* msg = new_signal_msg("JobDone");
+ DBusMessage* msg = new_signal_msg("JobStarted");
/* send unicast dbus signal */
if (!dbus_message_set_destination(msg, pDest))
die_out_of_memory();
+ uint64_t nJobID = uint64_t(pthread_self());
dbus_message_append_args(msg,
DBUS_TYPE_STRING, &pDest, /* TODO: redundant parameter, remove from API */
- DBUS_TYPE_UINT64, &job_id,
+ DBUS_TYPE_UINT64, &nJobID, /* TODO: redundant parameter, remove from API */
DBUS_TYPE_INVALID);
- VERB2 log("Sending signal JobDone('%s',%llx)", pDest, (unsigned long long)job_id);
+ VERB2 log("Sending signal JobStarted('%s',%llx)", pDest, (unsigned long long)nJobID);
send_flush_and_unref(msg);
}
-void CCommLayerServerDBus::JobStarted(const char* pDest, uint64_t job_id)
+void CCommLayerServerDBus::JobDone(const char* pDest, const char* pUUID)
{
- DBusMessage* msg = new_signal_msg("JobStarted");
+ DBusMessage* msg = new_signal_msg("JobDone");
/* send unicast dbus signal */
if (!dbus_message_set_destination(msg, pDest))
die_out_of_memory();
dbus_message_append_args(msg,
DBUS_TYPE_STRING, &pDest, /* TODO: redundant parameter, remove from API */
- DBUS_TYPE_UINT64, &job_id,
+ DBUS_TYPE_STRING, &pUUID, /* TODO: redundant parameter, remove from API */
DBUS_TYPE_INVALID);
- VERB2 log("Sending signal JobStarted('%s',%llx)", pDest, (unsigned long long)job_id);
+ VERB2 log("Sending signal JobDone('%s','%s')", pDest, pUUID);
send_flush_and_unref(msg);
}
@@ -493,17 +494,47 @@ static int handle_CreateReport(DBusMessage* call, DBusMessage* reply)
const char* sender;
long unix_uid = get_remote_uid(call, &sender);
- VERB1 log("got %s('%s') call from uid %ld", "CreateReport", pUUID, unix_uid);
- uint64_t argout1 = CreateReport_t(pUUID, to_string(unix_uid).c_str(), sender);
+ VERB1 log("got %s('%s') call from sender '%s' uid %ld", "CreateReport", pUUID, sender, unix_uid);
+ if (CreateReportThread(pUUID, to_string(unix_uid).c_str(), sender) != 0)
+ return -1; /* can't create thread (err msg is already logged) */
dbus_message_append_args(reply,
- DBUS_TYPE_UINT64, &argout1,
+ DBUS_TYPE_STRING, &pUUID, /* redundant, eliminate from API */
DBUS_TYPE_INVALID);
send_flush_and_unref(reply);
return 0;
}
+static int handle_GetJobResult(DBusMessage* call, DBusMessage* reply)
+{
+ const char* pUUID;
+ DBusMessageIter in_iter;
+ if (!dbus_message_iter_init(call, &in_iter))
+ {
+ error_msg("dbus call %s: no parameters", "GetJobResult");
+ return -1;
+ }
+ int r = load_val(&in_iter, pUUID);
+ if (r != LAST_FIELD)
+ {
+ if (r == MORE_FIELDS)
+ error_msg("dbus call %s: extra parameters", "GetJobResult");
+ return -1;
+ }
+
+ long unix_uid = get_remote_uid(call);
+ VERB1 log("got %s('%s') call from uid %ld", "GetJobResult", pUUID, unix_uid);
+ map_crash_report_t report = GetJobResult(pUUID, to_string(unix_uid).c_str());
+
+ DBusMessageIter out_iter;
+ dbus_message_iter_init_append(reply, &out_iter);
+ store_val(&out_iter, report);
+
+ send_flush_and_unref(reply);
+ return 0;
+}
+
static int handle_Report(DBusMessage* call, DBusMessage* reply)
{
map_crash_report_t argin1;
@@ -575,35 +606,6 @@ static int handle_DeleteDebugDump(DBusMessage* call, DBusMessage* reply)
return 0;
}
-static int handle_GetJobResult(DBusMessage* call, DBusMessage* reply)
-{
- uint64_t job_id;
- DBusMessageIter in_iter;
- if (!dbus_message_iter_init(call, &in_iter))
- {
- error_msg("dbus call %s: no parameters", "GetJobResult");
- return -1;
- }
- int r = load_val(&in_iter, job_id);
- if (r != LAST_FIELD)
- {
- if (r == MORE_FIELDS)
- error_msg("dbus call %s: extra parameters", "GetJobResult");
- return -1;
- }
-
- long unix_uid = get_remote_uid(call);
- VERB1 log("got %s(%llx) call from uid %ld", "GetJobResult", (long long)job_id, unix_uid);
- map_crash_report_t report = GetJobResult(job_id, to_string(unix_uid));
-
- DBusMessageIter out_iter;
- dbus_message_iter_init_append(reply, &out_iter);
- store_val(&out_iter, report);
-
- send_flush_and_unref(reply);
- return 0;
-}
-
static int handle_GetPluginsInfo(DBusMessage* call, DBusMessage* reply)
{
vector_map_string_t plugins_info = g_pPluginManager->GetPluginsInfo();