summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hirt <daniel.hirt@samsung.com>2015-09-21 12:45:27 +0300
committerYakov Goldberg <yakov.g@samsung.com>2015-09-28 19:21:36 +0300
commit56800f31dbb0b1cc1e03c162c55da6c40e693e07 (patch)
tree2fa3c49223cfa3e363f61b2ae2cfe07c70e476c3
parent769ca09029b2b593ad8e9028baf9fdef34ca98c6 (diff)
Change namings and cleanup
-rw-r--r--src/debugd.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/debugd.c b/src/debugd.c
index 45a0d97..a7d0b8d 100644
--- a/src/debugd.c
+++ b/src/debugd.c
@@ -22,7 +22,7 @@ static Ecore_Event_Handler *hnd_data = NULL;
22 return ECORE_CALLBACK_PASS_ON 22 return ECORE_CALLBACK_PASS_ON
23 23
24static Eina_Bool 24static Eina_Bool
25_cb_client_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 25_daemon_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
26{ 26{
27 IPC_HEAD(Add); 27 IPC_HEAD(Add);
28 printf("Client connected\n"); 28 printf("Client connected\n");
@@ -31,7 +31,7 @@ _cb_client_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
31} 31}
32 32
33static Eina_Bool 33static Eina_Bool
34_cb_client_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 34_daemon_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
35{ 35{
36 IPC_HEAD(Del); 36 IPC_HEAD(Del);
37 printf("Client deleted\n"); 37 printf("Client deleted\n");
@@ -57,7 +57,7 @@ _broadcast(Ecore_Ipc_Server *svr, int major, int minor, void *data, int size,
57} 57}
58 58
59static Eina_Bool 59static Eina_Bool
60_cb_client_data(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 60_daemon_data_from_bridge(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
61{ 61{
62 IPC_HEAD(Data); 62 IPC_HEAD(Data);
63 int *magic = (int *)e->data; 63 int *magic = (int *)e->data;
@@ -98,11 +98,11 @@ _server_init(void)
98 return EINA_FALSE; 98 return EINA_FALSE;
99 } 99 }
100 hnd_add = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, 100 hnd_add = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD,
101 _cb_client_add, NULL); 101 _daemon_add, NULL);
102 hnd_del = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, 102 hnd_del = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL,
103 _cb_client_del, NULL); 103 _daemon_del, NULL);
104 hnd_data = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, 104 hnd_data = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA,
105 _cb_client_data, NULL); 105 _daemon_data_from_bridge, NULL);
106 return EINA_TRUE; 106 return EINA_TRUE;
107} 107}
108 108
@@ -154,18 +154,13 @@ _cb_server_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
154 return ECORE_CALLBACK_PASS_ON 154 return ECORE_CALLBACK_PASS_ON
155 155
156static Eina_Bool 156static Eina_Bool
157_cb_server_data(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 157_bridge_data_from_daemon(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
158{ 158{
159 SVR_IPC_HEAD(Data); 159 SVR_IPC_HEAD(Data);
160 160
161 161
162 if (e->major == 1) // registration 162 if (e->major == 1) // registration
163 { 163 {
164#if 0
165 char tmp[1024];
166 strncpy(tmp, e->data, e->size);
167 fprintf(stdout, "Server responded (size %d)\n", e->size);
168#endif
169 int nb = fwrite(e->data, sizeof(char), e->size, stdout); 164 int nb = fwrite(e->data, sizeof(char), e->size, stdout);
170 fprintf(stderr,"Bytes %d\n", nb); 165 fprintf(stderr,"Bytes %d\n", nb);
171 fflush(stdout); 166 fflush(stdout);
@@ -190,7 +185,7 @@ _ipc_launch(void)
190 185
191 if (!srv_ipc) 186 if (!srv_ipc)
192 { 187 {
193 perror("Launched server but could not connect after 500 tries\n"); 188 fprintf(stderr, "Launched server but could not connect after 500 tries\n");
194 } 189 }
195} 190}
196 191
@@ -211,7 +206,7 @@ _bridge_init(void)
211 svr_hnd_del = ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, 206 svr_hnd_del = ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL,
212 _cb_server_del, NULL); 207 _cb_server_del, NULL);
213 svr_hnd_data = ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, 208 svr_hnd_data = ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA,
214 _cb_server_data, NULL); 209 _bridge_data_from_daemon, NULL);
215 210
216 return EINA_TRUE;; 211 return EINA_TRUE;;
217} 212}
@@ -252,7 +247,7 @@ _bridge(void)
252 /* Initialize debug daemon */ 247 /* Initialize debug daemon */
253 if (!_bridge_init()) 248 if (!_bridge_init())
254 { 249 {
255 perror("Exiting...\n"); 250 fprintf(stderr, "Exiting...\n");
256 return EINA_FALSE; 251 return EINA_FALSE;
257 } 252 }
258 253
@@ -266,7 +261,7 @@ _bridge(void)
266} 261}
267 262
268static Eina_Bool 263static Eina_Bool
269_cb_server_data_test(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 264_test_data_from_daemon(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
270{ 265{
271 SVR_IPC_HEAD(Data); 266 SVR_IPC_HEAD(Data);
272 267
@@ -294,7 +289,7 @@ _test_client_init(void)
294 svr_hnd_del = ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, 289 svr_hnd_del = ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL,
295 _cb_server_del, NULL); 290 _cb_server_del, NULL);
296 svr_hnd_data = ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, 291 svr_hnd_data = ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA,
297 _cb_server_data_test, NULL); 292 _test_data_from_daemon, NULL);
298 293
299 return EINA_TRUE;; 294 return EINA_TRUE;;
300} 295}