diff options
author | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-08-27 14:00:31 +0200 |
---|---|---|
committer | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-08-27 14:00:31 +0200 |
commit | 1dbb6423000e2fcd3fe9a1b6ddbf6200d522d470 (patch) | |
tree | d08261580175c8ad796d86bacbbc094c7aa08636 /src/Daemon | |
parent | bc17e32391578ee0128fe73719d1f691613d18fe (diff) | |
download | abrt-1dbb6423000e2fcd3fe9a1b6ddbf6200d522d470.tar.gz abrt-1dbb6423000e2fcd3fe9a1b6ddbf6200d522d470.tar.xz abrt-1dbb6423000e2fcd3fe9a1b6ddbf6200d522d470.zip |
added signal JobStarted => removed the ugly sleep() hack
Diffstat (limited to 'src/Daemon')
-rw-r--r-- | src/Daemon/CommLayerServer.h | 1 | ||||
-rw-r--r-- | src/Daemon/CommLayerServerDBus.cpp | 9 | ||||
-rw-r--r-- | src/Daemon/CommLayerServerDBus.h | 2 | ||||
-rw-r--r-- | src/Daemon/CrashWatcher.cpp | 13 |
4 files changed, 13 insertions, 12 deletions
diff --git a/src/Daemon/CommLayerServer.h b/src/Daemon/CommLayerServer.h index ededee5a..3a1177db 100644 --- a/src/Daemon/CommLayerServer.h +++ b/src/Daemon/CommLayerServer.h @@ -17,6 +17,7 @@ class CCommLayerServer { 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 JobStarted(const std::string &pDest, uint64_t pJobID) {}; virtual void Warning(const std::string& pMessage, uint64_t pJobID) {}; }; diff --git a/src/Daemon/CommLayerServerDBus.cpp b/src/Daemon/CommLayerServerDBus.cpp index d3e157d4..8077757e 100644 --- a/src/Daemon/CommLayerServerDBus.cpp +++ b/src/Daemon/CommLayerServerDBus.cpp @@ -230,6 +230,15 @@ void CCommLayerServerDBus::JobDone(const std::string &pDest, uint64_t job_id) emit_signal(sig); } +void CCommLayerServerDBus::JobStarted(const std::string &pDest, uint64_t job_id) +{ + ::DBus::SignalMessage sig("JobStarted"); + ::DBus::MessageIter wi = sig.writer(); + wi << pDest; + wi << job_id; + emit_signal(sig); +} + void CCommLayerServerDBus::Error(const std::string& arg1) { ::DBus::SignalMessage sig("Error"); diff --git a/src/Daemon/CommLayerServerDBus.h b/src/Daemon/CommLayerServerDBus.h index a3b54a7a..eda21964 100644 --- a/src/Daemon/CommLayerServerDBus.h +++ b/src/Daemon/CommLayerServerDBus.h @@ -38,7 +38,9 @@ class CCommLayerServerDBus virtual void AnalyzeComplete(const map_crash_report_t& arg1); virtual void Error(const std::string& arg1); virtual void Update(const std::string& pMessage, uint64_t pJobID); + //the job id should be enough in jobdone virtual void JobDone(const std::string& pDest, uint64_t pJobID); + virtual void JobStarted(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 27131799..288ecc0f 100644 --- a/src/Daemon/CrashWatcher.cpp +++ b/src/Daemon/CrashWatcher.cpp @@ -119,18 +119,7 @@ static void *create_report(void *arg) thread_data_t *thread_data = (thread_data_t *) arg; map_crash_info_t crashReport; - /* Ugly hack. - * We use DBus signals to talk to clients. - * If the report thread emits a signal with embedded job id before - * main thread returns this job id as a CreateReport() DBus call's - * return value, the client will not be able to understand - * that this signal is for its job. - * By no means this is the right solution. The right one would be - * to ensure that CreateReport() DBus call returns _before_ - * we continue here. This will need substantial surgery - * on our DBus machinery. TODO. - */ - usleep(10*1000); + g_pCommLayer->JobStarted(thread_data->dest, thread_data->thread_id); log("Creating report..."); try |