diff options
author | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-08-27 13:13:15 +0200 |
---|---|---|
committer | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-08-27 13:13:15 +0200 |
commit | bc17e32391578ee0128fe73719d1f691613d18fe (patch) | |
tree | 69c268cf7cbc8c91bb75e87d93d4d1aa8cf43879 | |
parent | caf38bbfe3279b9bea861e4d5b70f3c50c6e1755 (diff) | |
download | abrt-bc17e32391578ee0128fe73719d1f691613d18fe.tar.gz abrt-bc17e32391578ee0128fe73719d1f691613d18fe.tar.xz abrt-bc17e32391578ee0128fe73719d1f691613d18fe.zip |
don't encode the job id into message string, send it as an separate argument
-rw-r--r-- | lib/CommLayer/CommLayerInner.cpp | 6 | ||||
-rw-r--r-- | lib/CommLayer/Observer.h | 4 | ||||
-rw-r--r-- | src/Daemon/CommLayerServer.h | 3 | ||||
-rw-r--r-- | src/Daemon/CommLayerServerDBus.cpp | 13 | ||||
-rw-r--r-- | src/Daemon/CommLayerServerDBus.h | 3 | ||||
-rw-r--r-- | src/Daemon/CrashWatcher.cpp | 16 | ||||
-rw-r--r-- | src/Daemon/CrashWatcher.h | 4 | ||||
-rw-r--r-- | src/Gui/CCDBusBackend.py | 16 |
8 files changed, 38 insertions, 27 deletions
diff --git a/lib/CommLayer/CommLayerInner.cpp b/lib/CommLayer/CommLayerInner.cpp index 1a58814f..ec4dc904 100644 --- a/lib/CommLayer/CommLayerInner.cpp +++ b/lib/CommLayer/CommLayerInner.cpp @@ -18,8 +18,7 @@ void warn_client(const std::string& pMessage) pthread_t self = pthread_self(); if (self != s_main_id) { - std::string s = ssprintf("%%%llx: %s", (unsigned long long)self, pMessage.c_str()); - s_pObs->Warning(s); + s_pObs->Warning(pMessage,(uint64_t)self); //log("w: '%s'", s.c_str()); } else @@ -38,8 +37,7 @@ void update_client(const std::string& pMessage) pthread_t self = pthread_self(); if (self != s_main_id) { - std::string s = ssprintf("%%%llx: %s", (unsigned long long)self, pMessage.c_str()); - s_pObs->Status(s); + s_pObs->Status(pMessage, (uint64_t)self); //log("u: '%s'", s.c_str()); } else diff --git a/lib/CommLayer/Observer.h b/lib/CommLayer/Observer.h index f60fde45..928c78a3 100644 --- a/lib/CommLayer/Observer.h +++ b/lib/CommLayer/Observer.h @@ -9,9 +9,9 @@ class CObserver { public: virtual ~CObserver() {} - virtual void Status(const std::string& pMessage, const std::string& pDest="0") = 0; + virtual void Status(const std::string& pMessage, uint64_t pDest=0) = 0; virtual void Debug(const std::string& pMessage) = 0; - virtual void Warning(const std::string& pMessage) = 0; + virtual void Warning(const std::string& pMessage, uint64_t pDest=0) = 0; }; #endif diff --git a/src/Daemon/CommLayerServer.h b/src/Daemon/CommLayerServer.h index 2808f8a8..ededee5a 100644 --- a/src/Daemon/CommLayerServer.h +++ b/src/Daemon/CommLayerServer.h @@ -14,9 +14,10 @@ class CCommLayerServer { virtual void Crash(const std::string& progname, const std::string& uid) {} virtual void AnalyzeComplete(const map_crash_report_t& arg1) {} virtual void Error(const std::string& arg1) {} - virtual void Update(const std::string& pDest, const std::string& pMessage) {}; + virtual void Update(const std::string& pMessage, uint64_t pJobID) {}; virtual void Warning(const std::string& pMessage) {}; virtual void JobDone(const std::string &pDest, uint64_t pJobID) {}; + virtual void Warning(const std::string& pMessage, uint64_t pJobID) {}; }; #endif //COMMLAYERSERVER_H_ diff --git a/src/Daemon/CommLayerServerDBus.cpp b/src/Daemon/CommLayerServerDBus.cpp index dd1a01e4..d3e157d4 100644 --- a/src/Daemon/CommLayerServerDBus.cpp +++ b/src/Daemon/CommLayerServerDBus.cpp @@ -238,12 +238,12 @@ void CCommLayerServerDBus::Error(const std::string& arg1) emit_signal(sig); } -void CCommLayerServerDBus::Update(const std::string& pDest, const std::string& pMessage) +void CCommLayerServerDBus::Update(const std::string& pMessage, uint64_t pJobID) { ::DBus::SignalMessage sig("Update"); ::DBus::MessageIter wi = sig.writer(); - wi << pDest; wi << pMessage; + wi << pJobID; emit_signal(sig); } @@ -254,3 +254,12 @@ void CCommLayerServerDBus::Warning(const std::string& arg1) wi << arg1; emit_signal(sig); } + +void CCommLayerServerDBus::Warning(const std::string& pMessage, uint64_t pJobID) +{ + ::DBus::SignalMessage sig("Warning"); + ::DBus::MessageIter wi = sig.writer(); + wi << pMessage; + wi << pJobID; + emit_signal(sig); +} diff --git a/src/Daemon/CommLayerServerDBus.h b/src/Daemon/CommLayerServerDBus.h index 38450aa2..a3b54a7a 100644 --- a/src/Daemon/CommLayerServerDBus.h +++ b/src/Daemon/CommLayerServerDBus.h @@ -37,9 +37,10 @@ class CCommLayerServerDBus virtual void Crash(const std::string& progname, const std::string& uid); virtual void AnalyzeComplete(const map_crash_report_t& arg1); virtual void Error(const std::string& arg1); - virtual void Update(const std::string& pDest, const std::string& pMessage); + virtual void Update(const std::string& pMessage, uint64_t pJobID); virtual void JobDone(const std::string& pDest, uint64_t pJobID); virtual void Warning(const std::string& pMessage); + virtual void Warning(const std::string& pMessage, uint64_t pJobID); }; /* diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp index 4473659e..27131799 100644 --- a/src/Daemon/CrashWatcher.cpp +++ b/src/Daemon/CrashWatcher.cpp @@ -24,19 +24,19 @@ #include "ABRTException.h" #include "CrashWatcher.h" -void CCrashWatcher::Status(const std::string& pMessage, const std::string& pDest) +void CCrashWatcher::Status(const std::string& pMessage, uint64_t pJobID) { log("Update: %s", pMessage.c_str()); //FIXME: send updates only to job owner if (g_pCommLayer != NULL) - g_pCommLayer->Update(pDest, pMessage); + g_pCommLayer->Update(pMessage, pJobID); } -void CCrashWatcher::Warning(const std::string& pMessage) +void CCrashWatcher::Warning(const std::string& pMessage, uint64_t pJobID) { log("Warning: %s", pMessage.c_str()); if (g_pCommLayer != NULL) - g_pCommLayer->Warning(pMessage); + g_pCommLayer->Warning(pMessage, pJobID); } void CCrashWatcher::Debug(const std::string& pMessage) @@ -142,17 +142,17 @@ static void *create_report(void *arg) case MW_OK: break; case MW_IN_DB_ERROR: - g_cw->Warning(std::string("Did not find crash with UUID ")+thread_data->UUID+ " in database."); + g_cw->Warning(std::string("Did not find crash with UUID ")+thread_data->UUID+ " in database.",(uint64_t)thread_data->thread_id); break; case MW_PLUGIN_ERROR: - g_cw->Warning(std::string("Particular analyzer plugin isn't loaded or there is an error within plugin(s).")); + g_cw->Warning(std::string("Particular analyzer plugin isn't loaded or there is an error within plugin(s)."),(uint64_t)thread_data->thread_id); break; case MW_CORRUPTED: case MW_FILE_ERROR: default: { std::string debugDumpDir; - g_cw->Warning(std::string("Corrupted crash with UUID ")+thread_data->UUID+", deleting."); + g_cw->Warning(std::string("Corrupted crash with UUID ")+thread_data->UUID+", deleting.",(uint64_t)thread_data->thread_id); debugDumpDir = DeleteCrashInfo(thread_data->UUID, thread_data->UID); DeleteDebugDumpDir(debugDumpDir); } @@ -175,7 +175,7 @@ static void *create_report(void *arg) free(thread_data); throw e; } - g_cw->Warning(e.what()); + g_cw->Warning(e.what(),(uint64_t)thread_data->thread_id); } /* free strduped strings */ free(thread_data->UUID); diff --git a/src/Daemon/CrashWatcher.h b/src/Daemon/CrashWatcher.h index bf82a30b..b2e5341b 100644 --- a/src/Daemon/CrashWatcher.h +++ b/src/Daemon/CrashWatcher.h @@ -50,9 +50,9 @@ class CCrashWatcher public: /* Observer methods */ - virtual void Status(const std::string& pMessage, const std::string& pDest="0"); + virtual void Status(const std::string& pMessage, uint64_t pJobID=0); virtual void Debug(const std::string& pMessage); - virtual void Warning(const std::string& pMessage); + virtual void Warning(const std::string& pMessage, uint64_t pJobID=0); }; vector_crash_infos_t GetCrashInfos(const std::string &pUID); diff --git a/src/Gui/CCDBusBackend.py b/src/Gui/CCDBusBackend.py index 5af5c540..34a30005 100644 --- a/src/Gui/CCDBusBackend.py +++ b/src/Gui/CCDBusBackend.py @@ -22,6 +22,7 @@ class DBusManager(gobject.GObject): bus = None uniq_name = None def __init__(self): + self.pending_jobs = [] session = None # binds the dbus to glib mainloop DBusGMainLoop(set_as_default=True) @@ -99,15 +100,17 @@ class DBusManager(gobject.GObject): #print "crash" self.emit("crash") - def update_cb(self, dest, message): + def update_cb(self, message, job_id=0): # FIXME: use dest instead of 0 once we implement it in daemon #if self.uniq_name == dest: - self.emit("update", message) + if job_id == 0 or job_id in self.pending_jobs: + self.emit("update", message) - def warning_cb(self, message, dest=None): + def warning_cb(self, message, job_id=0): # FIXME: use dest instead of 0 once we implement it in daemon #if self.uniq_name == dest: - self.emit("warning", message) + if job_id == 0 or job_id in self.pending_jobs: + self.emit("warning", message) def analyze_complete_cb(self,dump): #for arg in args: @@ -157,8 +160,7 @@ class DBusManager(gobject.GObject): raise Exception(_("Please check if abrt daemon is running.")) def addJob(self, job_id): - pass - #self.pending_jobs.append(job_id) + self.pending_jobs.append(job_id) def jobdone_cb(self, dest, job_id): if self.uniq_name == dest: @@ -183,7 +185,7 @@ class DBusManager(gobject.GObject): def Report(self,report): # map < Plguin_name vec <status, message> > self.cc.Report(report, reply_handler=self.report_done, error_handler=self.error_handler_cb, timeout=60) - + def DeleteDebugDump(self,UUID): return self.cc.DeleteDebugDump(UUID) |