summaryrefslogtreecommitdiff
path: root/src/lib/ecore_ipc
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-11-22 23:55:57 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-11-22 23:55:57 -0200
commit520b57e974192dce8ad9ef130ca87c4a9525cddb (patch)
tree25bfc96eda76de4a1b498e02672b0816cf224874 /src/lib/ecore_ipc
parent89c326cd00e2b2a21ec7529e82a40fa5a14d7826 (diff)
ecore_ipc: refactor server data processing in its own function.
When we move to efl_net we'll reuse the same function to process incoming data, thus refactor the code in their own function so it can be reused.
Diffstat (limited to 'src/lib/ecore_ipc')
-rw-r--r--src/lib/ecore_ipc/ecore_ipc.c45
1 files changed, 33 insertions, 12 deletions
diff --git a/src/lib/ecore_ipc/ecore_ipc.c b/src/lib/ecore_ipc/ecore_ipc.c
index 9d10be71ef..296d61430d 100644
--- a/src/lib/ecore_ipc/ecore_ipc.c
+++ b/src/lib/ecore_ipc/ecore_ipc.c
@@ -1171,27 +1171,22 @@ _ecore_ipc_event_client_data(void *data EINA_UNUSED, int ev_type EINA_UNUSED, vo
1171 msg._member = _ecore_ipc_ddlt_int(d, svr->prev.i._member, md); 1171 msg._member = _ecore_ipc_ddlt_int(d, svr->prev.i._member, md);
1172 1172
1173static Eina_Bool 1173static Eina_Bool
1174_ecore_ipc_event_server_data(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev) 1174ecore_ipc_server_data_process(Ecore_Ipc_Server *svr, void *data, int size, Eina_Bool *stolen)
1175{ 1175{
1176 Ecore_Con_Event_Server_Data *e; 1176 /* use e->data and e->size to reduce diff to original code */
1177 1177 struct { void *data; int size; } _e = { data, size }, *e = &_e;
1178 e = ev; 1178 *stolen = EINA_FALSE;
1179 if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) 1179 if (1)
1180 return ECORE_CALLBACK_RENEW; 1180 { /* keep same identation as original code to help verification */
1181 /* handling code here */
1182 {
1183 Ecore_Ipc_Server *svr;
1184 Ecore_Ipc_Msg_Head msg; 1181 Ecore_Ipc_Msg_Head msg;
1185 int offset = 0; 1182 int offset = 0;
1186 unsigned char *buf = NULL; 1183 unsigned char *buf = NULL;
1187 1184
1188 svr = ecore_con_server_data_get(e->server);
1189
1190 if (!svr->buf) 1185 if (!svr->buf)
1191 { 1186 {
1192 svr->buf_size = e->size; 1187 svr->buf_size = e->size;
1193 svr->buf = e->data; 1188 svr->buf = e->data;
1194 e->data = NULL; /* take it out of the old event */ 1189 *stolen = EINA_TRUE;
1195 } 1190 }
1196 else 1191 else
1197 { 1192 {
@@ -1326,6 +1321,32 @@ _ecore_ipc_event_server_data(void *data EINA_UNUSED, int ev_type EINA_UNUSED, vo
1326 svr->buf_size -= offset; 1321 svr->buf_size -= offset;
1327 } 1322 }
1328 } 1323 }
1324
1325 return ECORE_CALLBACK_CANCEL;
1326}
1327
1328static Eina_Bool
1329_ecore_ipc_event_server_data(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev)
1330{
1331 Ecore_Con_Event_Server_Data *e;
1332
1333 e = ev;
1334 if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server)))
1335 return ECORE_CALLBACK_RENEW;
1336 /* handling code here */
1337 {
1338 Ecore_Ipc_Server *svr;
1339 Eina_Bool stolen;
1340
1341 svr = ecore_con_server_data_get(e->server);
1342
1343 ecore_ipc_server_data_process(svr, e->data, e->size, &stolen);
1344 if (stolen)
1345 {
1346 e->data = NULL;
1347 e->size = 0;
1348 }
1349 }
1329 return ECORE_CALLBACK_CANCEL; 1350 return ECORE_CALLBACK_CANCEL;
1330} 1351}
1331 1352