diff options
author | davemds <dave@gurumeditation.it> | 2014-08-23 16:50:16 +0200 |
---|---|---|
committer | davemds <dave@gurumeditation.it> | 2014-08-23 16:50:16 +0200 |
commit | a41106348ac94f9aa559ae35d8ef7262ae9ea0d7 (patch) | |
tree | 25efe372f4fab3caca5b84675d0150e36c376480 | |
parent | e592aa9647e76184c78acb3841eab2d7032b4617 (diff) |
added extra debug info (to be manually enabled)
-rw-r--r-- | efl/dbus_mainloop/e_dbus.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/efl/dbus_mainloop/e_dbus.c b/efl/dbus_mainloop/e_dbus.c index db43717..8798f46 100644 --- a/efl/dbus_mainloop/e_dbus.c +++ b/efl/dbus_mainloop/e_dbus.c | |||
@@ -36,6 +36,10 @@ static int e_dbus_idler_active = 0; | |||
36 | static int close_connection = 0; | 36 | static int close_connection = 0; |
37 | static int _edbus_init_count = 0; | 37 | static int _edbus_init_count = 0; |
38 | 38 | ||
39 | // change this define for extra debug | ||
40 | // #define DDBG(...) printf(__VA_ARGS__); printf("\n"); | ||
41 | #define DDBG(...) | ||
42 | |||
39 | 43 | ||
40 | static void | 44 | static void |
41 | e_dbus_message_free(void *data, void *message) | 45 | e_dbus_message_free(void *data, void *message) |
@@ -176,6 +180,7 @@ e_dbus_fd_handler_add(E_DBus_Handler_Data *hd) | |||
176 | Eina_List *l; | 180 | Eina_List *l; |
177 | Ecore_Fd_Handler *fdh; | 181 | Ecore_Fd_Handler *fdh; |
178 | 182 | ||
183 | DDBG("FD handler add"); | ||
179 | if (hd->fd_handler) return; | 184 | if (hd->fd_handler) return; |
180 | dflags = dbus_watch_get_flags(hd->watch); | 185 | dflags = dbus_watch_get_flags(hd->watch); |
181 | eflags = ECORE_FD_ERROR; | 186 | eflags = ECORE_FD_ERROR; |
@@ -187,13 +192,14 @@ e_dbus_fd_handler_add(E_DBus_Handler_Data *hd) | |||
187 | if (ecore_main_fd_handler_fd_get(fdh) == hd->fd) return; | 192 | if (ecore_main_fd_handler_fd_get(fdh) == hd->fd) return; |
188 | } | 193 | } |
189 | 194 | ||
190 | DBG("fd handler add (%d)", hd->fd); | 195 | DDBG("FD handler add on fd:%d (flags: %d)", hd->fd, dflags); |
191 | hd->fd_handler = ecore_main_fd_handler_add(hd->fd, | 196 | hd->fd_handler = ecore_main_fd_handler_add(hd->fd, |
192 | eflags, | 197 | eflags, |
193 | e_dbus_fd_handler, | 198 | e_dbus_fd_handler, |
194 | hd, | 199 | hd, |
195 | NULL, | 200 | NULL, |
196 | NULL); | 201 | NULL); |
202 | if (!hd->fd_handler) { DDBG("ERROR! cannot create FD handler") } | ||
197 | 203 | ||
198 | hd->cd->fd_handlers = eina_list_append(hd->cd->fd_handlers, hd->fd_handler); | 204 | hd->cd->fd_handlers = eina_list_append(hd->cd->fd_handlers, hd->fd_handler); |
199 | } | 205 | } |
@@ -203,7 +209,7 @@ e_dbus_handler_data_free(void *data) | |||
203 | { | 209 | { |
204 | E_DBus_Handler_Data *hd = data; | 210 | E_DBus_Handler_Data *hd = data; |
205 | 211 | ||
206 | DBG("e_dbus_handler_data_free"); | 212 | DDBG("e_dbus_handler_data_free"); |
207 | if (hd->fd_handler) | 213 | if (hd->fd_handler) |
208 | { | 214 | { |
209 | hd->cd->fd_handlers = eina_list_remove(hd->cd->fd_handlers, hd->fd_handler); | 215 | hd->cd->fd_handlers = eina_list_remove(hd->cd->fd_handlers, hd->fd_handler); |
@@ -225,7 +231,6 @@ e_dbus_handler_data_add(E_DBus_Connection *cd, DBusWatch *watch) | |||
225 | hd->enabled = dbus_watch_get_enabled(watch); | 231 | hd->enabled = dbus_watch_get_enabled(watch); |
226 | hd->fd = dbus_watch_get_unix_fd(hd->watch); | 232 | hd->fd = dbus_watch_get_unix_fd(hd->watch); |
227 | 233 | ||
228 | DBG("watch add (enabled: %d)", hd->enabled); | ||
229 | if (hd->enabled) e_dbus_fd_handler_add(hd); | 234 | if (hd->enabled) e_dbus_fd_handler_add(hd); |
230 | } | 235 | } |
231 | 236 | ||
@@ -237,7 +242,9 @@ cb_watch_add(DBusWatch *watch, void *data) | |||
237 | E_DBus_Connection *cd; | 242 | E_DBus_Connection *cd; |
238 | cd = data; | 243 | cd = data; |
239 | 244 | ||
240 | DBG("cb_watch_add"); | 245 | DDBG("Watch add on fd: %d (flags: %d) enable: %d", dbus_watch_get_unix_fd(watch), |
246 | dbus_watch_get_flags(watch), dbus_watch_get_enabled(watch)); | ||
247 | |||
241 | e_dbus_handler_data_add(cd, watch); | 248 | e_dbus_handler_data_add(cd, watch); |
242 | 249 | ||
243 | return true; | 250 | return true; |
@@ -248,7 +255,9 @@ cb_watch_del(DBusWatch *watch, void *data) | |||
248 | { | 255 | { |
249 | E_DBus_Handler_Data *hd; | 256 | E_DBus_Handler_Data *hd; |
250 | 257 | ||
251 | DBG("cb_watch_del"); | 258 | DDBG("Watch del on fd: %d (flags: %d)", dbus_watch_get_unix_fd(watch), |
259 | dbus_watch_get_flags(watch)); | ||
260 | |||
252 | hd = (E_DBus_Handler_Data *)dbus_watch_get_data(watch); | 261 | hd = (E_DBus_Handler_Data *)dbus_watch_get_data(watch); |
253 | e_dbus_fd_handler_del(hd); | 262 | e_dbus_fd_handler_del(hd); |
254 | } | 263 | } |
@@ -258,14 +267,14 @@ cb_watch_toggle(DBusWatch *watch, void *data) | |||
258 | { | 267 | { |
259 | E_DBus_Handler_Data *hd; | 268 | E_DBus_Handler_Data *hd; |
260 | 269 | ||
261 | DBG("cb_watch_toggle"); | 270 | DDBG("Watch toggle on fd: %d (flags: %d) enable: %d", dbus_watch_get_unix_fd(watch), |
262 | hd = dbus_watch_get_data(watch); | 271 | dbus_watch_get_flags(watch), dbus_watch_get_enabled(watch)); |
263 | 272 | ||
273 | hd = dbus_watch_get_data(watch); | ||
264 | if (!hd) return; | 274 | if (!hd) return; |
265 | 275 | ||
266 | hd->enabled = dbus_watch_get_enabled(watch); | 276 | hd->enabled = dbus_watch_get_enabled(watch); |
267 | 277 | ||
268 | INFO("watch %p is %sabled", hd, hd->enabled ? "en" : "dis"); | ||
269 | if (hd->enabled) e_dbus_fd_handler_add(hd); | 278 | if (hd->enabled) e_dbus_fd_handler_add(hd); |
270 | else e_dbus_fd_handler_del(hd); | 279 | else e_dbus_fd_handler_del(hd); |
271 | } | 280 | } |
@@ -545,3 +554,4 @@ e_dbus_connection_close(E_DBus_Connection *conn) | |||
545 | } | 554 | } |
546 | 555 | ||
547 | 556 | ||
557 | #undef DDBG | ||