summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2015-09-28 19:14:23 +0300
committerYakov Goldberg <yakov.g@samsung.com>2015-09-28 19:21:37 +0300
commitc25562165fa3a425e10b231804633fcf88c28c0e (patch)
tree7a488467d2290ef7694099894c3283c67b57878f
parent56800f31dbb0b1cc1e03c162c55da6c40e693e07 (diff)
Fixes and better sdb handling
-rw-r--r--src/Makefile2
-rw-r--r--src/client.c180
-rw-r--r--src/debugd.c130
3 files changed, 247 insertions, 65 deletions
diff --git a/src/Makefile b/src/Makefile
index bc6d2fe..f89f01b 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -8,7 +8,7 @@ client: client.c
8 $(CC) -o client client.c `pkg-config --cflags --libs efl ecore ecore-ipc` -Wall 8 $(CC) -o client client.c `pkg-config --cflags --libs efl ecore ecore-ipc` -Wall
9 9
10debugd: debugd.c 10debugd: debugd.c
11 $(CC) -o debugd debugd.c `pkg-config --cflags --libs efl ecore ecore-ipc` -Wall 11 $(CC) -o debugd debugd.c `pkg-config --cflags --libs efl ecore ecore-ipc ecore-file` -Wall
12 12
13clean: 13clean:
14 rm client debugd 14 rm client debugd
diff --git a/src/client.c b/src/client.c
index 9c152d0..684e68d 100644
--- a/src/client.c
+++ b/src/client.c
@@ -11,25 +11,43 @@
11 11
12Ecore_Exe *g_child = NULL; 12Ecore_Exe *g_child = NULL;
13Eina_Bool test_mode = EINA_FALSE; 13Eina_Bool test_mode = EINA_FALSE;
14char *g_bridge_file = NULL;
15char *g_bridge_lock_file = NULL;
14 16
15//static int _auto_remaining_tests = 10000; 17//static int _auto_remaining_tests = 10000;
16static int _auto_remaining_tests = 1; 18static int _auto_remaining_tests = 1000;
17static int _auto_buf_size; 19static int _auto_buf_size;
18static char _auto_buf[BUFFER_SIZE]; 20static char _auto_buf[BUFFER_SIZE];
19 21
20static Eina_Bool 22static Eina_Bool
21_send_message(char *msg) 23_send_data(char *msg, int size)
22{ 24{
23 if (!ecore_exe_send(g_child, msg, strlen(msg))) 25 char tmp[1024];
24 { 26 char msg2[BUFFER_SIZE];
25 fprintf(stderr, "Could not send message to child\n"); 27 static char seq = 1;
26 return EINA_FALSE; 28 int nm;
27 } 29
28 else 30 if (!g_bridge_file) return EINA_FALSE;
29 { 31
30 fprintf(stderr, "Father: I've sent this message: %s\n", msg); 32 sprintf(tmp, "sdb push msg %s &> /dev/null", g_bridge_file);
31 return EINA_TRUE; 33
32 } 34 msg2[0] = seq++;
35
36 memcpy(msg2 + 1, msg, size);
37
38 FILE *f = fopen("msg", "w+");
39 nm = fwrite(msg2, sizeof(char), size, f);
40 fflush(f);
41 fclose(f);
42
43 printf("Exec (size=%d): %s\n", size, tmp);
44 ecore_exe_run(tmp, NULL);
45
46 sprintf(tmp, "sdb shell \"sleep 1 && echo 0 >> %s\"", g_bridge_lock_file);
47 printf("Exec: %s\n", tmp);
48 ecore_exe_run(tmp, NULL);
49
50 return EINA_TRUE;
33} 51}
34 52
35static Eina_Bool 53static Eina_Bool
@@ -44,7 +62,7 @@ _fd_handler_cb(void *data, Ecore_Fd_Handler *fd_handler EINA_UNUSED)
44 } 62 }
45 63
46 fprintf(stdout, "Father: User entered: %s\n", msg); 64 fprintf(stdout, "Father: User entered: %s\n", msg);
47 _send_message(msg); 65 _send_data(msg, strlen(msg));
48 return ECORE_CALLBACK_RENEW; 66 return ECORE_CALLBACK_RENEW;
49} 67}
50 68
@@ -59,7 +77,6 @@ _pattern_auto_generate()
59 { 77 {
60 _auto_buf_size = rand() % 32000; 78 _auto_buf_size = rand() % 32000;
61 } while(!_auto_buf_size); 79 } while(!_auto_buf_size);
62 _auto_buf_size = 33000;
63 *magic = 0xDEADBEEF; 80 *magic = 0xDEADBEEF;
64 *size = _auto_buf_size; 81 *size = _auto_buf_size;
65 printf("Generating pattern: size %d\n", _auto_buf_size); 82 printf("Generating pattern: size %d\n", _auto_buf_size);
@@ -67,25 +84,53 @@ _pattern_auto_generate()
67 { 84 {
68 msg[i] = rand() % 256; 85 msg[i] = rand() % 256;
69 } 86 }
70 ecore_exe_send(g_child, _auto_buf, _auto_buf_size + sizeof(*magic) + sizeof(*size)); 87 _send_data(_auto_buf, _auto_buf_size + sizeof(*magic) + sizeof(*size));
71} 88}
72 89
73static Eina_Bool 90static Eina_Bool
74_msg_from_child_auto_handler(void *fdata EINA_UNUSED, int type EINA_UNUSED, 91_msg_from_child_auto_handler(void *fdata EINA_UNUSED, int type EINA_UNUSED,
75 void *event) 92 void *event)
76{ 93{
94 printf("Message from child\n");
95 Ecore_Exe_Event_Data *cdata = event;
96 if (!g_bridge_file)
97 {
98 printf("Initializing bridge file (size=%d)\n", cdata->size);
99 char msg[1024], tmp[1024];
100 strncpy(msg, cdata->data, cdata->size);
101 msg[cdata->size] = 0;
102 g_bridge_file = strdup(msg);
103 sprintf(tmp, "%s.lock", msg);
104 g_bridge_lock_file = strdup(tmp);
105 printf("Destination file set to %s\n", g_bridge_file);
106 return ECORE_CALLBACK_DONE;
107 }
108
77 static char msg[BUFFER_SIZE]; 109 static char msg[BUFFER_SIZE];
78 static int cur = 0, remaining = 0; 110 static int cur = 0, remaining = 0;
79 Ecore_Exe_Event_Data *cdata = event;
80 int *magic, *size; 111 int *magic, *size;
81 if (!remaining) 112 printf(" -- Received from bridge: %d bytes\n", cdata->size);
113 if (remaining <= 0)
82 { 114 {
115 printf(" ---- Doing magic checks\n");
83 magic = (int *)cdata->data; 116 magic = (int *)cdata->data;
84 size = (int *)(cdata->data + sizeof(*magic)); 117 size = (int *)(cdata->data + sizeof(*magic));
85 118
86 if (*magic != 0xDEADBEEF) 119 if (*magic != 0xDEADBEEF)
87 { 120 {
88 printf("Bad magic number %X\n", *magic); 121 int off;
122 char str[cdata->size + 1];
123 printf("Bad magic number %X. Data size: %d\n", *magic, cdata->size);
124 strncpy(str, cdata->data, cdata->size);
125 str[cdata->size] = 0;
126 printf(" -- Maybe it's a string: %s\n", str);
127 for (off = 0; off < cdata->size; off++)
128 {
129 char c = ((char *)cdata->data)[off];
130 if (off) printf(", ");
131 printf("%c", c);
132 }
133 printf("\n");
89 return ECORE_CALLBACK_DONE; 134 return ECORE_CALLBACK_DONE;
90 } 135 }
91 remaining = *size + sizeof(*magic) + sizeof(*size); 136 remaining = *size + sizeof(*magic) + sizeof(*size);
@@ -93,21 +138,25 @@ _msg_from_child_auto_handler(void *fdata EINA_UNUSED, int type EINA_UNUSED,
93 remaining -= cdata->size; 138 remaining -= cdata->size;
94 memcpy(msg + cur, cdata->data, cdata->size); 139 memcpy(msg + cur, cdata->data, cdata->size);
95 cur += cdata->size; 140 cur += cdata->size;
96 printf("Received from bridge: %d bytes\n", cdata->size);
97 141
98 if (!remaining) 142 printf(" -- Check if there are remaining packets\n");
143 if (remaining <= 0)
99 { 144 {
145 remaining = 0;
146 printf(" ---- Received whole data\n");
100 cur = 0; 147 cur = 0;
101 magic = (int *)msg; 148 magic = (int *)msg;
102 size = (int *)(msg + sizeof(*magic)); 149 size = (int *)(msg + sizeof(*magic));
103 if (*magic != 0xDEADBEEF) printf("Bad magic number %X\n", *magic); 150 if (*magic != 0xDEADBEEF) printf("Bad magic number %X\n", *magic);
104 else if (_auto_buf_size != *size) 151 else if (_auto_buf_size != *size)
105 printf("Bad size (%d-%d) for received buffer\n", _auto_buf_size, *size); 152 printf("Bad size (%d-%d) for received buffer\n", _auto_buf_size, *size);
106 else if (!memcmp(_auto_buf, msg+sizeof(*magic)+sizeof(*size), _auto_buf_size)) 153 else if (memcmp(_auto_buf, msg+sizeof(*magic)+sizeof(*size), _auto_buf_size))
107 printf("Bad contents for received buffer\n"); 154 {
155 printf("Bad contents for received buffer\n");
156 }
108 else 157 else
109 { 158 {
110 printf("Received buffer ok\n"); 159 printf(" ---- Received buffer ok\n");
111 _pattern_auto_generate(); 160 _pattern_auto_generate();
112 } 161 }
113 } 162 }
@@ -128,53 +177,78 @@ _msg_from_child_handler(void *data EINA_UNUSED, int type EINA_UNUSED,
128 return ECORE_CALLBACK_DONE; 177 return ECORE_CALLBACK_DONE;
129} 178}
130 179
131static Ecore_Exe * 180static Eina_Bool
132_init_bridge(void) 181_su_timer(void *data EINA_UNUSED)
133{ 182{
134 Ecore_Exe *exe; 183 Ecore_Exe *exe = data;
135 const char *cmd_sdb = "sdb shell"; 184 char *cmd = "su\n";
136 const char *cmd_bridge = "/home/developer/debugd bridge\n"; 185 if (exe && !test_mode)
137 const char *cmd_test = "./debugd bridge";
138
139 const char *cmd;
140 const char *profile = getenv("DBG_PROFILE");
141
142 if (profile && !strcmp(profile, "test"))
143 {
144 printf ("Starting test profile\n");
145 cmd = cmd_test;
146 test_mode = EINA_TRUE;
147 }
148 else
149 { 186 {
150 cmd = cmd_sdb; 187 /* Once we have the shell, we will run the bridge start command.
151 } 188 * This is a workaround because 'sdb shell [command]' does
152 189 * '/bin/sh -' */
153 printf ("Starting bridge with command: %s\n", cmd); 190 printf("Executing bridge command on sdb shell\n");
191 if (!ecore_exe_send(exe, cmd, strlen(cmd)))
192 {
193 printf("Failed sending cmd to sdb exe\n");
154 194
155 exe = ecore_exe_pipe_run(cmd, 195 }
156 ECORE_EXE_PIPE_WRITE | 196 }
157 ECORE_EXE_PIPE_READ, 197 return ECORE_CALLBACK_CANCEL;
158 NULL); 198}
159 199
200static Eina_Bool
201_bridge_timer(void *data)
202{
203 char *cmd = "/home/developer/debugd bridge\n";
204 Ecore_Exe *exe = data;
160 if (exe && !test_mode) 205 if (exe && !test_mode)
161 { 206 {
162 /* Once we have the shell, we will run the bridge start command. 207 /* Once we have the shell, we will run the bridge start command.
163 * This is a workaround because 'sdb shell [command]' does 208 * This is a workaround because 'sdb shell [command]' does
164 * '/bin/sh -' */ 209 * '/bin/sh -' */
165 printf("Executing bridge command on sdb shell\n"); 210 printf("Executing bridge command on sdb shell\n");
166 if (!ecore_exe_send(exe, "su\n", strlen("su\n")) || 211 if (!ecore_exe_send(exe, cmd, strlen(cmd)))
167 //!ecore_exe_send(exe, "su app\n", strlen("su app\n")) ||
168 !ecore_exe_send(exe, cmd_bridge, strlen(cmd_bridge))
169 )
170 { 212 {
171 printf("Failed sending cmd to sdb exe\n"); 213 printf("Failed sending cmd to sdb exe\n");
172 214
173 } 215 }
174 } 216 }
217 return ECORE_CALLBACK_CANCEL;
218}
219
220static Ecore_Exe *
221_init_bridge(void)
222{
223 Ecore_Exe *exe;
224 const char *cmd_bridge = "export PATH=$PATH:~/tizen-sdk/tools; sdb shell /home/developer/debugd bridge";
225 const char *cmd_test = "./debugd bridge";
226
227 const char *cmd;
228 const char *profile = getenv("DBG_PROFILE");
229
230 if (profile && !strcmp(profile, "test"))
231 {
232 printf ("Starting test profile\n");
233 cmd_bridge = cmd_test;
234 test_mode = EINA_TRUE;
235 }
236
237 printf ("Starting bridge with command: %s\n", cmd_bridge);
238 exe = ecore_exe_pipe_run(cmd_bridge,
239 ECORE_EXE_PIPE_WRITE |
240 ECORE_EXE_PIPE_READ,
241 NULL);
175 return exe; 242 return exe;
176} 243}
177 244
245static Eina_Bool
246_on_timer(void *data EINA_UNUSED)
247{
248 _pattern_auto_generate();
249 return ECORE_CALLBACK_CANCEL;
250}
251
178int main (int argc, char **argv) 252int main (int argc, char **argv)
179{ 253{
180 if (!ecore_init()) 254 if (!ecore_init())
@@ -191,7 +265,7 @@ int main (int argc, char **argv)
191 if (argc > 1 && !strcmp(argv[1], "auto")) 265 if (argc > 1 && !strcmp(argv[1], "auto"))
192 { 266 {
193 ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _msg_from_child_auto_handler, NULL); 267 ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _msg_from_child_auto_handler, NULL);
194 _pattern_auto_generate(); 268 ecore_timer_add(1.0, _on_timer, NULL);
195 } 269 }
196 else 270 else
197 { 271 {
diff --git a/src/debugd.c b/src/debugd.c
index a7d0b8d..d7e646b 100644
--- a/src/debugd.c
+++ b/src/debugd.c
@@ -2,6 +2,7 @@
2#include <stdlib.h> 2#include <stdlib.h>
3#include <unistd.h> 3#include <unistd.h>
4#include <Ecore.h> 4#include <Ecore.h>
5#include <Ecore_File.h>
5#include <Ecore_Ipc.h> 6#include <Ecore_Ipc.h>
6#include <ctype.h> 7#include <ctype.h>
7 8
@@ -25,7 +26,7 @@ static Eina_Bool
25_daemon_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 26_daemon_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
26{ 27{
27 IPC_HEAD(Add); 28 IPC_HEAD(Add);
28 printf("Client connected\n"); 29 printf("Client %p connected\n", e->client);
29 30
30 return ECORE_CALLBACK_DONE; 31 return ECORE_CALLBACK_DONE;
31} 32}
@@ -35,7 +36,7 @@ _daemon_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
35{ 36{
36 IPC_HEAD(Del); 37 IPC_HEAD(Del);
37 printf("Client deleted\n"); 38 printf("Client deleted\n");
38 ecore_ipc_client_del(e->client); 39 //ecore_ipc_client_del(e->client);
39 return ECORE_CALLBACK_DONE; 40 return ECORE_CALLBACK_DONE;
40} 41}
41 42
@@ -47,10 +48,16 @@ _broadcast(Ecore_Ipc_Server *svr, int major, int minor, void *data, int size,
47 Eina_List *l; 48 Eina_List *l;
48 Ecore_Ipc_Client *cl; 49 Ecore_Ipc_Client *cl;
49 50
51 printf("Broadcasting\n");
52 if (eina_list_count(ipc_clients) == 0)
53 {
54 printf(" -- But there are no clients\n");
55 }
50 EINA_LIST_FOREACH(ipc_clients, l, cl) 56 EINA_LIST_FOREACH(ipc_clients, l, cl)
51 { 57 {
52 if (cl != ignore) 58 if (cl != ignore)
53 { 59 {
60 printf(" -- Sending to client %p (size: %d)\n", cl, size);
54 ecore_ipc_client_send(cl, major, minor, 0, 0, 0, data, size); 61 ecore_ipc_client_send(cl, major, minor, 0, 0, 0, data, size);
55 } 62 }
56 } 63 }
@@ -59,6 +66,7 @@ _broadcast(Ecore_Ipc_Server *svr, int major, int minor, void *data, int size,
59static Eina_Bool 66static Eina_Bool
60_daemon_data_from_bridge(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 67_daemon_data_from_bridge(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
61{ 68{
69 printf("Hello world\n");
62 IPC_HEAD(Data); 70 IPC_HEAD(Data);
63 int *magic = (int *)e->data; 71 int *magic = (int *)e->data;
64 printf("Received Data from client: size %d magic %X\n", e->size, *magic); 72 printf("Received Data from client: size %d magic %X\n", e->size, *magic);
@@ -158,12 +166,28 @@ _bridge_data_from_daemon(void *data EINA_UNUSED, int type EINA_UNUSED, void *eve
158{ 166{
159 SVR_IPC_HEAD(Data); 167 SVR_IPC_HEAD(Data);
160 168
161
162 if (e->major == 1) // registration 169 if (e->major == 1) // registration
163 { 170 {
164 int nb = fwrite(e->data, sizeof(char), e->size, stdout); 171 FILE *tmp;
165 fprintf(stderr,"Bytes %d\n", nb); 172 static int sent_times = 1;
173 char str[1024];
174 //int nb = fwrite(e->data, e->size, 1, stdout);
175 int nb = fwrite(e->data, e->size, 1, stdout);
166 fflush(stdout); 176 fflush(stdout);
177
178 sprintf(str, "/home/developer/sent%d", sent_times);
179 tmp = fopen(str, "w+");
180 fprintf(tmp, "item size: %d, written items: %d\n", e->size, nb);
181 fflush(tmp);
182 fclose(tmp);
183
184 sprintf(str, "/home/developer/sent%d.data", sent_times);
185 tmp = fopen(str, "w+");
186 fwrite(e->data, e->size, 1, tmp);
187 fflush(tmp);
188 fclose(tmp);
189
190 sent_times++;
167 } 191 }
168 return ECORE_CALLBACK_DONE; 192 return ECORE_CALLBACK_DONE;
169} 193}
@@ -185,7 +209,7 @@ _ipc_launch(void)
185 209
186 if (!srv_ipc) 210 if (!srv_ipc)
187 { 211 {
188 fprintf(stderr, "Launched server but could not connect after 500 tries\n"); 212 //fprintf(stderr, "Launched server but could not connect after 500 tries\n");
189 } 213 }
190} 214}
191 215
@@ -198,6 +222,7 @@ _bridge_init(void)
198 222
199 if (!srv_ipc) 223 if (!srv_ipc)
200 { 224 {
225 while (1) {}
201 ecore_ipc_shutdown(); 226 ecore_ipc_shutdown();
202 return EINA_FALSE; 227 return EINA_FALSE;
203 } 228 }
@@ -223,31 +248,105 @@ _fd_handler_cb(void *data, Ecore_Fd_Handler *fd_handler EINA_UNUSED)
223 if (*magic != 0xDEADBEEF) return ECORE_CALLBACK_RENEW; 248 if (*magic != 0xDEADBEEF) return ECORE_CALLBACK_RENEW;
224 fread(size, sizeof(*size), 1, stdin); 249 fread(size, sizeof(*size), 1, stdin);
225 len = *size; 250 len = *size;
226 fprintf(stderr, "Bridge: have to receive from client %d+8 bytes\n", *size); 251 //fprintf(stderr, "Bridge: have to receive from client %d+8 bytes\n", *size);
227 tmp = msg + sizeof(*magic) + sizeof(*size); 252 tmp = msg + sizeof(*magic) + sizeof(*size);
228 while(len > 0) 253 while(len > 0)
229 { 254 {
230 int nb = fread(tmp, 1, len, stdin); 255 int nb = fread(tmp, 1, len, stdin);
231 if (nb <= 0) 256 if (nb <= 0)
232 { 257 {
233 fprintf(stderr, "fread returns bad result\n"); 258 //fprintf(stderr, "fread returns bad result\n");
234 return ECORE_CALLBACK_RENEW; 259 return ECORE_CALLBACK_RENEW;
235 } 260 }
236 len -= nb; 261 len -= nb;
237 tmp += nb; 262 tmp += nb;
238 } 263 }
239 fprintf(stderr, "Bridge: received from client %d+8 bytes\n", *size); 264 //fprintf(stderr, "Bridge: received from client %d+8 bytes\n", *size);
240 ecore_ipc_server_send(srv_ipc, 1, 0, 0, 0, 0, msg, *size + sizeof(*magic) + sizeof(*size)); 265 ecore_ipc_server_send(srv_ipc, 1, 0, 0, 0, 0, msg, *size + sizeof(*magic) + sizeof(*size));
241 return ECORE_CALLBACK_RENEW; 266 return ECORE_CALLBACK_RENEW;
242} 267}
243 268
269const char *tmp_dir = "/home/developer/tmp";
270
271static char *
272_check_strip_cmd(char* cmd)
273{
274 static char seq = 1;
275 char tmp = *cmd;
276
277 if (tmp != seq)
278 {
279 return NULL;
280 }
281
282 seq++; /* all ok. increment seq */
283 return cmd + 1;
284}
285
286static void
287_process_data(char *data, int size)
288{
289 //fprintf(stderr, "Bridge: received from client %d+8 bytes\n", *size);
290 ecore_ipc_server_send(srv_ipc, 1, 0, 0, 0, 0, data, size);
291}
292
293static void
294_lock_file_monitor_cb(void *data, Ecore_File_Monitor *em,
295 Ecore_File_Event event, const char *path)
296{
297 char *bridge_file = data;
298 char cmd[BUFFER_SIZE];
299 char *cmd2;
300
301 if (event != ECORE_FILE_EVENT_CLOSED) return;
302
303 FILE *f = fopen(bridge_file, "r");
304 if (!f) return;
305
306 int nm = fread(cmd, sizeof(char), BUFFER_SIZE, f);
307 fclose(f);
308 if (!nm) return;
309 cmd2 = _check_strip_cmd(cmd);
310
311 if (cmd2)
312 {
313 _process_data(cmd2, nm); /* minus the seq counter */
314 }
315}
316
244static Eina_Bool 317static Eina_Bool
245_bridge(void) 318_bridge(void)
246{ 319{
320 char tmp[1024], tmp2[1024];
321 FILE *f;
322 Ecore_File_Monitor *fm;
323
324 /* We use files here. Yeah... */
325 if (!ecore_file_init())
326 {
327 return EINA_FALSE;
328 }
329
330 /* Send first message to client with the required cmd file path to push */
331 sprintf(tmp, "%s/bridge-%d", tmp_dir, getpid());
332
333 /* Sending monitored file that is pushed from client */
334 fprintf(stdout, "%s", tmp);
335 fflush(stdout);
336
337 sprintf(tmp2, "%s/bridge-%d.lock", tmp_dir, getpid());
338 f = fopen(tmp2, "w+");
339 fclose(f);
340 f = fopen("/home/developer/lock", "w+");
341 fprintf(f, "%s\n", tmp2);
342 fclose(f);
343 fm = ecore_file_monitor_add(tmp2, _lock_file_monitor_cb, tmp);
344
247 /* Initialize debug daemon */ 345 /* Initialize debug daemon */
346 //fprintf(stderr, "This is the bridge process..\n");
248 if (!_bridge_init()) 347 if (!_bridge_init())
249 { 348 {
250 fprintf(stderr, "Exiting...\n"); 349 //fprintf(stderr, "Exiting...\n");
251 return EINA_FALSE; 350 return EINA_FALSE;
252 } 351 }
253 352
@@ -256,6 +355,7 @@ _bridge(void)
256 _fd_handler_cb, 355 _fd_handler_cb,
257 NULL, NULL, NULL); 356 NULL, NULL, NULL);
258 ecore_main_loop_begin(); 357 ecore_main_loop_begin();
358 ecore_file_shutdown();
259 359
260 return EINA_TRUE; 360 return EINA_TRUE;
261} 361}
@@ -269,6 +369,7 @@ _test_data_from_daemon(void *data EINA_UNUSED, int type EINA_UNUSED, void *event
269 printf("Received Message: size %d magic %X\n", e->size, *magic); 369 printf("Received Message: size %d magic %X\n", e->size, *magic);
270 if (e->major == 1) 370 if (e->major == 1)
271 { 371 {
372 printf("Test client sending data\n");
272 ecore_ipc_server_send(srv_ipc, 1, 0, 0, 0, 0, e->data, e->size); 373 ecore_ipc_server_send(srv_ipc, 1, 0, 0, 0, 0, e->data, e->size);
273 } 374 }
274 return ECORE_CALLBACK_DONE; 375 return ECORE_CALLBACK_DONE;
@@ -339,7 +440,14 @@ int main (int argc, char **argv)
339 } 440 }
340 441
341 if (mode == DAEMON_MODE_BRIDGE) 442 if (mode == DAEMON_MODE_BRIDGE)
342 _bridge(); 443 {
444 if (!_bridge())
445 {
446 ecore_ipc_shutdown();
447 ecore_shutdown();
448 goto exit;
449 }
450 }
343 else if (mode == DAEMON_MODE_TEST) 451 else if (mode == DAEMON_MODE_TEST)
344 _test(); 452 _test();
345 else 453 else